SmartQueryTools

Type Inference Report

Drop any data file to see the detected type for every column. You also get a suggested SQL type, null rates, approximate distinct counts, and min/max values. Runs entirely in your browser using DuckDB-WASM.

Loading DuckDB engine…

Drop your data file here

CSV, TSV, Parquet, JSON, NDJSON, Arrow, Excel or YAML

or click to browse · max 50 MB

How to use the Type Inference Report

  1. Drag a data file onto the drop area, or click it to browse. CSV, TSV, Parquet, JSON, NDJSON, Arrow, Excel (.xlsx or .xls, first sheet) and YAML files are supported, up to 50 MB.
  2. Wait for the file to load. The summary cards then show the row count, the column count, and how many columns are more than half empty.
  3. Read the report table. Each row is one column from your file, with its detected type, a suggested SQL type, null count, null percentage, approximate distinct count, and minimum and maximum values.
  4. Look for highlighted null percentages. Amber means more than 50% of values are missing. Red means the column is completely empty.
  5. Click Download CSV to save the report as type-inference-report.csv.

Worked example

A small CSV export of user signups, with one missing score.

Input (signups.csv)

id,signup_date,plan,score,active
1,2024-01-15,pro,88.5,true
2,2024-02-03,free,,false
3,2024-02-20,pro,92.0,true

Report table

Column       DuckDB Type  Suggested SQL     Null Count  Null %  Distinct (approx.)  Min         Max
id           BIGINT       BIGINT            0           0.0%    ~3                  1           3
signup_date  DATE         DATE              0           0.0%    ~3                  2024-01-15  2024-02-20
plan         VARCHAR      TEXT              0           0.0%    ~2                  free        pro
score        DOUBLE       DOUBLE PRECISION  1           33.3%   ~2                  88.5        92.0
active       BOOLEAN      BOOLEAN           0           0.0%    ~2                  false       true

Whole numbers are detected as BIGINT and ISO dates as DATE. The plan column holds text, so it is VARCHAR with a suggested SQL type of TEXT. The decimal score column is DOUBLE, which maps to DOUBLE PRECISION. The empty score in row 2 counts as a null, which is 1 of 3 rows, or 33.3%. The summary cards read 3 rows, 5 columns and 0 null-heavy columns.

Using the report before a database import

Run the report before you write a CREATE TABLE statement. It tells you which columns can be NOT NULL, which ones need to allow nulls, and which types will hold the data without errors.

Compare the min and max values with what you expect. A date column whose max is in the future, or a quantity column with a negative minimum, often points to bad rows. A text column where you expected numbers usually means one value does not parse, such as N/A or a number with a thousands separator.

Columns shown in red hold no data at all and can often be dropped. Columns with an approximate distinct count of 1 almost always hold the same value on every row.

Frequently Asked Questions

How are column types detected in a CSV file?

CSV files store everything as text, so the tool samples the values in each column and picks the narrowest type that fits all of them. A column of whole numbers becomes BIGINT, decimals become DOUBLE, values like 2024-01-15 become DATE, and true or false become BOOLEAN. If any value does not fit, the column falls back to VARCHAR.

What is the Suggested SQL column?

It maps the detected type to a standard SQL type you can use in a CREATE TABLE statement. The suggestion always holds every value the detected type can hold. VARCHAR maps to TEXT, DOUBLE to DOUBLE PRECISION, and DECIMAL keeps its precision and scale. Very large or unsigned integers widen to exact NUMERIC types: HUGEINT becomes NUMERIC(38,0) and UBIGINT becomes NUMERIC(20,0). Lists and structs map to JSON. Treat it as a starting point and adjust it for your database, for example a fixed NUMERIC for money.

Why is my ID or postcode column shown as a number?

If every value in a column looks like a number, it is detected as a number. That also means leading zeros would be dropped on import. Codes such as postcodes, phone numbers and account IDs are usually safer stored as TEXT.

Are the distinct counts exact?

No. The column is labelled Distinct (approx.) and each value has a ~ in front. The count uses a fast estimate that is usually exact for small numbers of values and within a few percent for large columns. Use it to spot low-cardinality columns. For an exact count, use the Data Profiler.

Is the file uploaded?

No. The file is read and analysed in your browser. Nothing is sent to a server.

Related tools