CSV to PostgreSQL Schema
Paste a CSV sample and get a CREATE TABLE statement with inferred column types, a suggested primary key, and the conflict target to use for an upsert.
| Column | Postgres type | Nullable | Distinct | Why |
|---|
DDL
Ready to automate?
Simple Data Foundry reads a CSV from a URL and writes it into Postgres on a schedule — append, replace or upsert on the key this tool suggests.
Frequently Asked Questions
How does it choose a type?
By checking every non-empty value in the column against the narrowest type that fits, then widening. A column of whole numbers inside the 32-bit range becomes integer; anything larger becomes bigint. Decimals become numeric rather than double precision, because numeric is exact and money is the usual reason a decimal column exists. Values that all parse as dates become date or timestamptz depending on whether a time is present.
Why numeric instead of float or double precision?
Because binary floating point cannot represent most decimal fractions exactly, and the errors surface exactly where they hurt: totals that are a penny out, and comparisons that fail for no visible reason. numeric is slower and correct. If you are storing measurements rather than money, double precision is the better choice and you should overrule the suggestion.
What makes a good primary key?
A column that is fully populated and unique across every row in your sample. The tool reports both, so you can see why a column did or did not qualify. That same column is usually the right conflict target for an upsert — the thing that decides whether an incoming row updates an existing record or creates a new one.
Should I trust it on a small sample?
Treat it as a first draft. A thousand rows that happen to contain no nulls will suggest NOT NULL on a column that is nullable in reality, and a numeric-looking ID column with leading zeros — a postcode, a product code — will be read as a number and lose them. The tool flags leading zeros for that reason.
Is my data uploaded anywhere?
No. Parsing, inference and DDL generation all happen in your browser. Nothing leaves the page and there is no server to send it to.