# Fields and projections

{% hint style="success" %}
This is the official documentation of the `forestadmin-agent-django` and `forestadmin-agent-flask` Python agents.
{% endhint %}

### Fields

Field identifiers simply are strings that identify a column in the context of a collection.

Let’s consider the following database structure; collections, fields and relationships:

{% @mermaid/diagram content="erDiagram
Books |o--|| Authors: ManyToOne
Books ||--o| Reviews: OneToMany

Books {
int id
int authorId
string title
ManyToOne myAuthor
OneToMany myReviews
}
Authors {
int id
string firstname
string lastname
}
Reviews {
int id
int bookId
string content
int rating
}" %}

In this context, you’ll find below some examples that show valid and invalid field calls:

| Collection | Field                | Valid?                                                           |
| ---------- | -------------------- | ---------------------------------------------------------------- |
| Books      | "title"              | 🟢 Yes                                                           |
| Books      | "myAuthor:firstname" | 🟢 Yes                                                           |
| Books      | "myReviews:content"  | ❌ No, only relationships which yield one record can be traversed |
| Reviews    | "content"            | 🟢 Yes                                                           |
| Reviews    | "myBook:title"       | ❌ No, reverse relationships are *not* automatically defined      |

### Projections

Projections are mainly used to fetch partial records and automatically fetch linked records.

Projections simply are an array of fields.

```json
["id", "title", "author:firstName"] // for books
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forestadmin.com/developer-guide-agents-python/data-sources/getting-started/queries/fields-projections.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
