Skip to content
Snippets Groups Projects
Unverified Commit 3ec2c7da authored by Jeff Bruemmer's avatar Jeff Bruemmer Committed by GitHub
Browse files

docs - csv upload id name (#36600)

parent b7d6dc77
Branches
Tags
No related merge requests found
......@@ -43,11 +43,9 @@ When people upload a CSV to a collection, Metabase will:
- Create a table to store that data in the database and schema that the Admin selected to store uploads.
- Create a [model](../data-modeling/models.md) that wraps the uploaded table, and save that model to the collection the person uploaded the CSV data to.
## Primary key detection and auto-generation
## Primary key auto-generation
When you upload data, Metabase will try to detect whether the uploaded CSV file includes a column with an incrementing ID. The check is pretty basic: it'll check for a column named `id` or `pk` that has integers for each row in the uploaded CSV. Each integer in this column should be unique, so if your CSV includes duplicate ID integers, the column won't work as [an entity key](../data-modeling/field-types.md#list-of-metabase-field-types).
If Metabase doesn't detect a primary key, it will create an ID column for you, including this ID column as the first (left-most) column of the uploaded CSV table.
When you upload a CSV, Metabase will create an a unique primary key column, called `_mb_row_id`, as the first (left-most) column of the uploaded CSV table. This `_mb_row_id` column will contain automatically generated integers. Metabase will also ignore any columns in the upload that have a name that will be in the database with the same name as the auto-generated primary key column (e.g., `_MB row-ID` in the CSV will be `_mb_row_id` or `_MB_ROW_ID` in the database).
If you don't want this autogenerated ID column, you can always remove the column from the model Metabase created. Visit the model, click on the info **i** icon, then **Model details**. From the model details page, click the **Edit definition** button. In the Data section of the query builder, click on the down arrow next to the table, deselect the added ID column, and save your changes.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment