intosql 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ .venv/
2
+ dist/
3
+ .coverage
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ __pycache__/
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - `convert` and `convert_url`, every conversion endpoint (`create`, `create_from_url`, `upload`, `start`, `retrieve`, `list`, `cancel`, `create_case`, `delete`, `wait`), `usage`, `spec`, `verify_webhook` and `parse_webhook`.
6
+ - `IntoSQLError`, `ConversionFailedError`, `ConversionCanceledError` and `WebhookSignatureError`.
7
+ - Retries for `rate_limited`, `too_many_active`, `request_in_progress`, 408, 425, 5xx and lost connections, with one `Idempotency-Key` per request; never `already_started`.
intosql-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 IntoSQL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
intosql-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.5
2
+ Name: intosql
3
+ Version: 0.1.0
4
+ Summary: Convert spreadsheets, CSV and JSON into SQL with the IntoSQL API.
5
+ Project-URL: Homepage, https://intosql.com/docs/sdks/python
6
+ Project-URL: Documentation, https://intosql.com/docs/sdks/python
7
+ Project-URL: Repository, https://github.com/alfonsobries/intosql
8
+ Project-URL: Changelog, https://github.com/alfonsobries/intosql/blob/main/sdks/python/CHANGELOG.md
9
+ Author-email: IntoSQL <hello@intosql.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: converter,csv,excel,mysql,postgresql,sql,sqlite,xlsx
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Topic :: Database
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.9
21
+ Requires-Dist: httpx<1,>=0.27
22
+ Description-Content-Type: text/markdown
23
+
24
+ # IntoSQL for Python
25
+
26
+ Convert spreadsheets (XLSX, XLS, ODS), CSV and JSON into SQL for PostgreSQL, MySQL, MariaDB, SQLite, SQL Server or Oracle with the [IntoSQL API](https://intosql.com/developers). Column types are inferred and dirty values fixed, so the script loads on the first try.
27
+
28
+ ```sh
29
+ pip install intosql
30
+ ```
31
+
32
+ Python 3.9 or newer. The API is part of IntoSQL Pro; make a key in Settings, API keys.
33
+
34
+ ## Convert a file
35
+
36
+ ```python
37
+ import os
38
+ from intosql import IntoSQL, spec
39
+
40
+ intosql = IntoSQL(os.environ["INTOSQL_API_KEY"])
41
+
42
+ conversion = intosql.convert(
43
+ "ventas.xlsx",
44
+ name="ventas.xlsx",
45
+ spec=spec("postgresql", table="ventas"),
46
+ )
47
+
48
+ print(conversion["report"]["rows"]["converted"], conversion["output"]["url"])
49
+ ```
50
+
51
+ 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.
52
+
53
+ ## Convert a file by URL
54
+
55
+ ```python
56
+ conversion = intosql.convert_url(
57
+ "https://example.com/exports/ventas.csv",
58
+ spec=spec("mysql"),
59
+ )
60
+ ```
61
+
62
+ ## Check a webhook
63
+
64
+ Save a webhook address in Settings, API keys, and IntoSQL calls it when a conversion is done, failed or canceled.
65
+
66
+ ```python
67
+ from intosql import parse_webhook
68
+
69
+ # Raises WebhookSignatureError when the signature doesn't match.
70
+ event = parse_webhook(
71
+ request.get_data(),
72
+ request.headers.get("IntoSQL-Signature", ""),
73
+ os.environ["INTOSQL_WEBHOOK_SECRET"],
74
+ )
75
+ ```
76
+
77
+ ## Errors and retries
78
+
79
+ 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.
80
+
81
+ Every endpoint: [intosql.com/developers](https://intosql.com/developers). This SDK: [intosql.com/docs/sdks/python](https://intosql.com/docs/sdks/python).
@@ -0,0 +1,58 @@
1
+ # IntoSQL for Python
2
+
3
+ Convert spreadsheets (XLSX, XLS, ODS), CSV and JSON into SQL for PostgreSQL, MySQL, MariaDB, SQLite, SQL Server or Oracle with the [IntoSQL API](https://intosql.com/developers). Column types are inferred and dirty values fixed, so the script loads on the first try.
4
+
5
+ ```sh
6
+ pip install intosql
7
+ ```
8
+
9
+ Python 3.9 or newer. The API is part of IntoSQL Pro; make a key in Settings, API keys.
10
+
11
+ ## Convert a file
12
+
13
+ ```python
14
+ import os
15
+ from intosql import IntoSQL, spec
16
+
17
+ intosql = IntoSQL(os.environ["INTOSQL_API_KEY"])
18
+
19
+ conversion = intosql.convert(
20
+ "ventas.xlsx",
21
+ name="ventas.xlsx",
22
+ spec=spec("postgresql", table="ventas"),
23
+ )
24
+
25
+ print(conversion["report"]["rows"]["converted"], conversion["output"]["url"])
26
+ ```
27
+
28
+ 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.
29
+
30
+ ## Convert a file by URL
31
+
32
+ ```python
33
+ conversion = intosql.convert_url(
34
+ "https://example.com/exports/ventas.csv",
35
+ spec=spec("mysql"),
36
+ )
37
+ ```
38
+
39
+ ## Check a webhook
40
+
41
+ Save a webhook address in Settings, API keys, and IntoSQL calls it when a conversion is done, failed or canceled.
42
+
43
+ ```python
44
+ from intosql import parse_webhook
45
+
46
+ # Raises WebhookSignatureError when the signature doesn't match.
47
+ event = parse_webhook(
48
+ request.get_data(),
49
+ request.headers.get("IntoSQL-Signature", ""),
50
+ os.environ["INTOSQL_WEBHOOK_SECRET"],
51
+ )
52
+ ```
53
+
54
+ ## Errors and retries
55
+
56
+ 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.
57
+
58
+ Every endpoint: [intosql.com/developers](https://intosql.com/developers). This SDK: [intosql.com/docs/sdks/python](https://intosql.com/docs/sdks/python).
@@ -0,0 +1,97 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.25"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "intosql"
7
+ dynamic = ["version"]
8
+ description = "Convert spreadsheets, CSV and JSON into SQL with the IntoSQL API."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.9"
13
+ authors = [{ name = "IntoSQL", email = "hello@intosql.com" }]
14
+ keywords = [
15
+ "converter",
16
+ "csv",
17
+ "excel",
18
+ "mysql",
19
+ "postgresql",
20
+ "sql",
21
+ "sqlite",
22
+ "xlsx",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: Developers",
27
+ "Operating System :: OS Independent",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3 :: Only",
30
+ "Topic :: Database",
31
+ "Typing :: Typed",
32
+ ]
33
+ dependencies = ["httpx>=0.27,<1"]
34
+
35
+ [project.urls]
36
+ Homepage = "https://intosql.com/docs/sdks/python"
37
+ Documentation = "https://intosql.com/docs/sdks/python"
38
+ Repository = "https://github.com/alfonsobries/intosql"
39
+ Changelog = "https://github.com/alfonsobries/intosql/blob/main/sdks/python/CHANGELOG.md"
40
+
41
+ [dependency-groups]
42
+ dev = ["mypy>=1.13", "pytest>=8.3", "pytest-cov>=5", "ruff>=0.8"]
43
+
44
+ [tool.hatch.version]
45
+ path = "src/intosql/_version.py"
46
+
47
+ [tool.hatch.build.targets.wheel]
48
+ packages = ["src/intosql"]
49
+
50
+ [tool.hatch.build.targets.sdist]
51
+ include = ["src/intosql", "tests", "README.md", "CHANGELOG.md", "LICENSE"]
52
+
53
+ [tool.pytest.ini_options]
54
+ testpaths = ["tests"]
55
+ pythonpath = ["tests"]
56
+ addopts = "--strict-markers"
57
+
58
+ [tool.coverage.run]
59
+ source = ["intosql"]
60
+ branch = true
61
+
62
+ [tool.coverage.report]
63
+ show_missing = true
64
+ fail_under = 100
65
+
66
+ [tool.mypy]
67
+ strict = true
68
+ python_version = "3.9"
69
+ files = ["src", "tests"]
70
+
71
+ [tool.ruff]
72
+ target-version = "py39"
73
+ line-length = 100
74
+
75
+ [tool.ruff.lint]
76
+ select = [
77
+ "E",
78
+ "W",
79
+ "F",
80
+ "I",
81
+ "B",
82
+ "UP",
83
+ "N",
84
+ "SIM",
85
+ "RUF",
86
+ "PT",
87
+ "C4",
88
+ "RET",
89
+ "PL",
90
+ "S",
91
+ "ANN",
92
+ "A",
93
+ ]
94
+ ignore = ["PLR0913", "PLR2004", "PLR0911"]
95
+
96
+ [tool.ruff.lint.per-file-ignores]
97
+ "tests/**" = ["S101", "S105", "S106", "ANN", "PLR2004"]
@@ -0,0 +1,103 @@
1
+ """Convert spreadsheets, CSV and JSON into SQL with the IntoSQL API."""
2
+
3
+ from ._client import DEFAULT_BASE_URL, Conversions, IntoSQL, Upload
4
+ from ._contract import (
5
+ CONTRACT_VERSION,
6
+ ColumnKind,
7
+ ColumnNames,
8
+ ColumnReport,
9
+ ColumnSpec,
10
+ DateOrder,
11
+ DetectedInput,
12
+ Dialect,
13
+ ErrorCode,
14
+ Fix,
15
+ FixCode,
16
+ InferenceSpec,
17
+ InputFormat,
18
+ InputSpec,
19
+ JobReport,
20
+ JobSpec,
21
+ OutputFormat,
22
+ OutputSpec,
23
+ OutputStyle,
24
+ Problem,
25
+ RowCounts,
26
+ Severity,
27
+ Timings,
28
+ )
29
+ from ._errors import (
30
+ ConversionCanceledError,
31
+ ConversionFailedError,
32
+ IntoSQLError,
33
+ WebhookSignatureError,
34
+ )
35
+ from ._spec import spec
36
+ from ._types import (
37
+ Case,
38
+ Conversion,
39
+ ConversionErrorCode,
40
+ ConversionFailure,
41
+ ConversionOutput,
42
+ ConversionStatus,
43
+ ConversionUpload,
44
+ Page,
45
+ PageLinks,
46
+ PageMeta,
47
+ PingData,
48
+ Usage,
49
+ WebhookEvent,
50
+ )
51
+ from ._version import __version__
52
+ from ._webhooks import parse_webhook, verify_webhook
53
+
54
+ __all__ = [
55
+ "CONTRACT_VERSION",
56
+ "DEFAULT_BASE_URL",
57
+ "Case",
58
+ "ColumnKind",
59
+ "ColumnNames",
60
+ "ColumnReport",
61
+ "ColumnSpec",
62
+ "Conversion",
63
+ "ConversionCanceledError",
64
+ "ConversionErrorCode",
65
+ "ConversionFailedError",
66
+ "ConversionFailure",
67
+ "ConversionOutput",
68
+ "ConversionStatus",
69
+ "ConversionUpload",
70
+ "Conversions",
71
+ "DateOrder",
72
+ "DetectedInput",
73
+ "Dialect",
74
+ "ErrorCode",
75
+ "Fix",
76
+ "FixCode",
77
+ "InferenceSpec",
78
+ "InputFormat",
79
+ "InputSpec",
80
+ "IntoSQL",
81
+ "IntoSQLError",
82
+ "JobReport",
83
+ "JobSpec",
84
+ "OutputFormat",
85
+ "OutputSpec",
86
+ "OutputStyle",
87
+ "Page",
88
+ "PageLinks",
89
+ "PageMeta",
90
+ "PingData",
91
+ "Problem",
92
+ "RowCounts",
93
+ "Severity",
94
+ "Timings",
95
+ "Upload",
96
+ "Usage",
97
+ "WebhookEvent",
98
+ "WebhookSignatureError",
99
+ "__version__",
100
+ "parse_webhook",
101
+ "spec",
102
+ "verify_webhook",
103
+ ]