CSV SafePreview · destination contract preflight

Check a CSV against a destination schema contract

A CSV can be structurally valid and still fail at the destination. A small contract comparison makes those assumptions visible before a table is created or an import command is run. CSV SafePreview checks the source locally against expected column names, narrow logical types, nullability, uniqueness, and allowed values.

Explicit gate: PASS means no contract findings were detected. WARN means export remains available but a review point needs attention. FAIL visibly blocks SQL preview and download until the CSV or contract is corrected. The gate does not connect to a database or certify a production migration.

What the bounded checker compares

Columns and order

Missing destination columns fail. Extra source columns and a different common order warn so a mapping decision is not hidden.

Types and dates

Integer, numeric, boolean, text, and ISO date expectations are compared with conservative inference. Ambiguous source values remain text.

Rows and values

Non-nullable blanks, duplicate values, and values outside an allowed set receive source-row and source-column references.

How to use it

  1. Open CSV SafePreview and paste CSV text or choose a local file.
  2. Analyze the CSV and review row-shape errors and inferred types.
  3. Paste a contract with column,type,required,nullable,unique,allowed_values. Separate allowed values with |.
  4. Run the contract check. Each finding explains its rule, contract/source column, and contract/source row when applicable.
  5. Use SQL preview or download only when the visible verdict and findings fit the intended import review.

The contract is intentionally small: it is a review aid for a bounded local batch, not a mapping engine, repair tool, foreign-key checker, migration runner, or database administration service.

Privacy-safe offending-value references

Row and column locations are useful without exposing cell contents. By default, reports omit offending values. If a user explicitly confirms that the values are non-sensitive, the local report may include at most five short, truncated references to help distinguish repeated or out-of-set values. Do not enable that option for confidential, personal, financial, health, credential, or customer data.

CSV SafePreview has no upload, account, network request, browser storage, analytics, or tracking behavior. Local text is read in the browser and is not retained after the page is closed.

Related CSV import guides

Start with the CSV import preflight guide for delimiter, line-ending, header, and row-shape checks. For SQL-specific context, read CSV to PostgreSQL without uploading and PostgreSQL COPY preflight. Then return to the local SQL preview tool for the complete diagnose → contract check → preview → handoff workflow.

Frequently asked questions

Does WARN stop SQL export?

No. WARN is intentionally advisory for extra columns, order differences, and bounded checks that need human review. PASS and WARN allow preview and download; FAIL blocks both.

Does a PASS prove the destination schema is correct?

No. It means only that this bounded comparison found no configured contract mismatch in the rows checked. Confirm encoding, import settings, constraints, permissions, and a safe test environment separately.

Can this upload or connect to PostgreSQL?

No. It produces local diagnostics and conservative SQL text only. It does not send the CSV, store it, use credentials, or execute SQL.