@@ -15,80 +15,105 @@ Field types dictate how Metabase displays its data, as well as the column’s sp
Metabase recognizes the following field types:
-**Overall Row**
-**Entity Key** – The field in this table that uniquely identifies each row. Could be a product ID, serial number, etc.
-**Entity Name** – Different from the entity key, the entity name represents what each row in the table *is*. For example, in a Users table, the User column might be the entity name.
-**Foreign Key** – The column in this table that (usually) refers to the primary key of another table in order to connect data from different tables that are related. For example, in a Products table, you might have a Customer ID field that points to a Customers table, where Customer ID is the primary key.
-**Common**
- Category
- Comment
- Description
- Title
-**Location**
- City
- Country
- Latitude
- Longitude
- State
- Zip Code
-**Financial**
- Cost
- Currency
- Discount
- Gross margin
- Income
- Price
-**Numeric**
- Quantity
- Score
- Share
- Percentage
-**Profile**
- Birthday
- Company
- Email
- Owner
- Subscription
- User
-**Date and Time**
- Cancelation date
- Cancelation time
- Cancelation timestamp
- Creation date
- Creation time
- Creation timestamp
- Deletion date
- Deletion time
- Deletion timestamp
- Updated date
- Updated time
- Updated timestamp
- Join date
- Join time
- Join timestamp
- UNIX Timestamp (Milliseconds)
- UNIX Timestamp (Seconds)
-**Categorical**
-**Enum** - An abbreviation for “enumerated type,” the value of an enum draws on a predefined list of options. An example of an enum would be a field for the months of the year. This list of twelve options is defined in makeup of the column, and no options outside this list would be valid.
- Product
- Source
-**URLs**
- Avatar Image URL
- Image URL
- URL
-**Other**
- Field containing JSON
-**No semantic type** – Used for fields that don't fall into any of the above field types.
### Overall Row
-**Entity Key**. The field in this table that uniquely identifies each row. Could be a product ID, serial number, etc.
-**Entity Name**. Different from the entity key, the entity name represents what each row in the table *is*. For example, in a Users table, the User column might be the entity name.
-**Foreign Key**. The column in this table that (usually) refers to the primary key of another table in order to connect data from different tables that are related. For example, in a Products table, you might have a Customer ID field that points to a Customers table, where Customer ID is the primary key.
### Common
Common task
-**Category**
-**Comment**
-**Description**
-**Title**
### Location
-**City**
-**Country**
-**Latitude**
-**Longitude**
-**State**
-**Zip Code**
### Financial
-**Cost**
-**Currency**
-**Discount**
-**Gross margin**
-**Income**
-**Price**
### Numeric
-**Percentage**
-**Quantity**
-**Score**
-**Share**. The same as percentage, so prefer "Percentage".
### Profile
-**Birthday**
-**Company**
-**Email**
-**Owner**
-**Subscription**
-**User**
### Date and Time
If your database stores datetimes as a number or string, you can [cast that column to a datetime](./metadata-editing.md#casting-to-a-specific-data-type).
-**Cancelation date**
-**Cancelation time**
-**Cancelation timestamp**
-**Creation date**
-**Creation time**
-**Creation timestamp**
-**Deletion date**
-**Deletion time**
-**Deletion timestamp**
-**Updated date**
-**Updated time**
-**Updated timestamp**
-**Join date**
-**Join time**
-**Join timestamp**
-**UNIX Timestamp (Milliseconds)**
-**UNIX Timestamp (Seconds)**
### Categorical
-**Enum** - An abbreviation for “enumerated type,” the value of an enum draws on a predefined list of options. An example of an enum would be a field for the months of the year. This list of twelve options is defined in makeup of the column, and no options outside this list would be valid.
-**Product**
-**Source**. For example, the source of a visitor to your website.
### URLs
-**Avatar Image URL**
-**Image URL**
-**URL**
### Other
-**Field containing JSON**.
-**No semantic type** – Used for fields that don't fall into any of the above field types.
## Using field types in Metabase
### Fields types in models
### Set column types in models to enable people to explore results with the query builder
You can set field types for models, which helps Metabase understand how to work with data in models built using SQL. You can also configure text fields in models to [surface individual records in search](./models.md#surface-individual-records-in-search-by-matching-against-this-column).
You can set field types for models, which helps Metabase understand how to work with data in models built using SQL. If you set each column type in a SQL model, people will be able to explore that model using the query builder and drill-through menus.
With records that include integer entity keys, you can also configure text fields in models to [surface individual records in search](./models.md#surface-individual-records-in-search-by-matching-against-this-column).
### X-rays
When you [X-ray](../exploration-and-organization/x-rays.md) a table or model, Metabase considers both the data type and the field type to display different charts that summarize that data.
When you [X-ray](../exploration-and-organization/x-rays.md) a table, model, or entity, Metabase considers both the data type and field type to display different charts that summarize that data.
### Field Filters
...
...
@@ -100,6 +125,7 @@ If you're an administrator, you can edit field types using the [Table Metadata p
While data types themselves can't be edited in Metabase, admins can manually [cast data types](./metadata-editing.md#casting-to-a-specific-data-type) to be read differently, like interpreting a numerical data type as a date format.
## Further Reading
-[Exploring data with Metabase's data browser](https://www.metabase.com/learn/getting-started/data-browser.html).
@@ -22,6 +22,7 @@ For a deep dive on why and how to use models, check out our [Learn article on mo
You can use models to:
- Create, uh, models, with model here meaning an intuitive description of some concept in your business that you codify as a set of columns. An example model could be a "customer", which is a table that pulls together customer information from multiple tables and adds computed columns, like adding a lifetime value (LTV) column. This model represents the [measures and dimensions][measures-dimensions] that you think are relevant to your understanding of your customers.
- Let people explore the results of SQL queries with the drill-through menu and query builder (provided you [set the column types](#column-type)).
- Create summary tables that aggregate data from multiple tables.
- Clean up tables with unnecessary columns and rows filtered out.
...
...
@@ -80,7 +81,7 @@ You can also edit the model's metadata.
## Add metadata to columns in a model
Metadata is the secret sauce of models. When you write a SQL query, Metabase can display the results, but it can't "know" what kind of data it's returning (like it can with questions built using the query builder). What this means in practice is that people won't be able to drill-through the results, because Metabase doesn't understand what the results are. With models, however, you can tell Metabase what kind of data is in each returned column so that Metabase can still do its drill-through magic. Metadata will also make filtering nicer by showing the correct filter widget, and it will help Metabase to pick the right visulization for the results.
Metadata is the secret sauce of models. When you write a SQL query, Metabase can display the results, but it can't "know" what kind of data it's returning (like it can with questions built using the query builder). What this means in practice is that people won't be able to drill-through the results, or explore the results with the query builder, because Metabase doesn't understand what the results are. With models, however, you can tell Metabase what kind of data is in each returned column so that Metabase can still do its drill-through magic. Metadata will also make filtering nicer by showing the correct filter widget, and it will help Metabase to pick the right visulization for the results.
If you only set one kind of metadata, set the **Column type** to let Metabase know what kind of data it's working with.
...
...
@@ -98,7 +99,9 @@ For models based on SQL queries, you can tell Metabase if the column has the sam
### Column type
You can set the [column type][column-type]. The default is "No special type". Be sure to set the Column type so people can interact with the results.
You can set the [column type][column-type]. The default is "No special type".
If your model is based on a SQL query and you want people to be able to explore the results with the query builder and drill-through menu, you'll need to set the [column type](./field-types.md) for each column in your model.
### This column should appear in...
...
...
@@ -114,7 +117,7 @@ You can specify whether a column should appear in the table view, or just in a d
### Surface individual records in search by matching against this column
For string fields in records with entity keys, Metabase will give you the option make the values in that field show up when people search your Metabase. Essentially, Metabase will index these values and make them available to Metabase's search engine. This option is handy when people often want to jump straight to an individual record in your model.
For string fields in records with integer entity keys, Metabase will give you the option make the values in that field show up when people search your Metabase. Essentially, Metabase will index these values and make them available to Metabase's search engine. This option is handy when people often want to jump straight to an individual record in your model.
For example, if you have a model with accounts, you could turn on this option for a column listing the account's name or email so that people can quickly search for specific accounts in the model from anywhere in your Metabase. When people click on a record in the search results, Metabase will jump straight to the model and the object detail for that record.