How can I turn off import guessing?
CARTO includes type and content guessing functionality during the import process.
Content Guessing
Content guessing means that our importer will automatically detect a column of IP addresses, a column of country names, or decimal degree coordinates in a column named latitude or lat + decimal degree coordinates in a column named longitude or lon. It will generate geometry from those, so when the import is finished you will see values in your dataset’s the_geom
column. If you create a map from this dataset you will see features appear in the Map View.
Content guessing is enabled by default when you import a file via your CARTO dashboard. It is not enabled by default if you use the Import API.
Type Guessing
Type guessing means that our importer will detect if each dataset column contains text, numeric or true/false values. You will see these columns appear as string
, number
, and boolean
types respectively once the dataset is in your CARTO account.
It also detects dates if they are in YYYY-MM-DD date format or YYYY-MM-DD HH:MM:SS/YYYY-MM-DDTHH:MM:SSZ timestamp formats. For those the importer will set your CARTO dataset’s column type to date
.
Type guessing is enabled by default for both CARTO dashboard and Import API imports. The dashboard and Import API also enable quoted fields guessing by default. For more information about that please see this section of our Import API documentation.
Turn off Guessing for dashboard imports
In some cases you might not want guessing to happen.
For example, if a column of numeric postal codes is imported CARTO guesses that it’s a column of numbers. That means any leading zeroes are dropped, which can make postal codes that should start with 0 unrecognizable to a geocoder.
If you are importing your dataset via your CARTO dashboard, to turn off guessing click the New dataset
button in your dashboard. In the next Add datasets
screen un-check the Let CARTO automatically guess data types and content on import
box before connecting your file.
Note: Even if guessing is disabled in your CARTO dashboard, a CSV containing Well-Known-Binary values will automatically have geometry generated on import. So will shapefiles, geojsons, geopackage and KML files that contain geometry.
Turn off Guessing for Import API imports
Parameters you can use to disable the different types of import guessing are listed in our Import API documentation for standard tables, sync tables, and database connectors.