Skip to main content

IntoSQL for Python

Convert spreadsheets (XLSX, XLS, ODS), CSV and JSON into SQL for PostgreSQL, MySQL, MariaDB, SQLite, SQL Server or Oracle with the IntoSQL API. Column types are inferred and dirty values fixed, so the script loads on the first try.

pip install intosql

Python 3.9 or newer. The API is part of IntoSQL Pro; make a key in Settings, API keys.

Convert a file

import os
from intosql import IntoSQL, spec

intosql = IntoSQL(os.environ["INTOSQL_API_KEY"])

conversion = intosql.convert(
    "ventas.xlsx",
    name="ventas.xlsx",
    spec=spec("postgresql", table="ventas"),
)

print(conversion["report"]["rows"]["converted"], conversion["output"]["url"])

The file streams to storage as it is; the output URL downloads the script for ten minutes. Read the conversion again (intosql.conversions.retrieve(id)) for a fresh one.

A MySQL, MariaDB, PostgreSQL, SQL Server or SQLite dump (.sql, .sql.gz), or a SQLite database file, converts to any of the six databases like any file. Its report lists each table in tables, with its own columns, fixes and problems, where the dump came from in source, and the views, triggers, routines and events it did not carry in not_converted.

conversion = intosql.convert("shop.sql.gz", name="shop.sql.gz", spec=spec("postgresql"))

for table in conversion["report"].get("tables", []):
    print(table["name"], table["rows"])

Convert a file by URL

conversion = intosql.convert_url(
    "https://example.com/exports/ventas.csv",
    spec=spec("mysql"),
)

Check a webhook

Save a webhook address in Settings, API keys, and IntoSQL calls it when a conversion is done, failed or canceled.

from intosql import parse_webhook

# Raises WebhookSignatureError when the signature doesn't match.
event = parse_webhook(
    request.get_data(),
    request.headers.get("IntoSQL-Signature", ""),
    os.environ["INTOSQL_WEBHOOK_SECRET"],
)

Errors and retries

Failed requests raise IntoSQLError with the HTTP status, a code that doesn't change (needs_pro, over_quota, too_big, invalid_spec, invalid_url and more) and the request_id. A conversion that ends as failed raises ConversionFailedError with its code and the engine's problems. Rate limits, a full account, server errors and lost connections are retried twice with the same idempotency key (max_retries changes it); already_started never is.

Every endpoint: intosql.com/developers. This SDK: intosql.com/docs/sdks/python.

Metadata

Release files for intosql 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for intosql 0.3.2
File Size Uploaded Provenance
intosql-0.3.2.tar.gz 20.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for intosql 0.3.2
File Interpreter ABI Platform
intosql-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 35.8 kB

Release files / intosql-0.3.2.tar.gz

Download URL intosql-0.3.2.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cb5f718d16faaec20d90f85438d9a67f4930171d8646582a24ab3b700d0b3751
BLAKE2b-256 checksum
How to use checksums
7f8f5f0941d0fe012bdf7a9436c95509af220ec39e6a11eec950c989b785de9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / intosql-0.3.2-py3-none-any.whl

Download URL intosql-0.3.2-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
221bec368d9227bc9c9840ea00f876f9fd67fa4d226f92443073756dfa5bfaf8
BLAKE2b-256 checksum
How to use checksums
e4d29a9a21c70a6720ca60c9b7a4d6c0695607953f29c9e96187671aa573cf10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for intosql 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page