vsql-python 1.0.0__cp312-cp312-win_amd64.whl

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,156 @@
1
+ Metadata-Version: 2.4
2
+ Name: vsql-python
3
+ Version: 1.0.0
4
+ Summary: A DB-API 2.0 (PEP 249) driver for vsql, a single file or in-memory SQL database.
5
+ Author-email: Elliot Chance <elliotchance@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/elliotchance/vsql-python
8
+ Project-URL: vsql, https://github.com/elliotchance/vsql
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: C
11
+ Classifier: Topic :: Database
12
+ Classifier: Topic :: Database :: Database Engines/Servers
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ License-File: internal/amalgamation/LICENSE
17
+ License-File: internal/amalgamation/LICENSE-V
18
+ Dynamic: license-file
19
+
20
+ # vsql-python
21
+
22
+ A [DB-API 2.0 (PEP 249)](https://peps.python.org/pep-0249/) driver for
23
+ [vsql](https://github.com/elliotchance/vsql), a single file or in-memory SQL
24
+ database. libvsql (the vsql library) is compiled into the package, so there's
25
+ nothing else to install.
26
+
27
+ ```sh
28
+ pip install vsql-python
29
+ ```
30
+
31
+ ```python
32
+ import vsql
33
+
34
+ with vsql.connect("test.vsql") as conn:
35
+ cur = conn.cursor()
36
+ cur.execute("CREATE TABLE foo (x INTEGER)")
37
+ cur.execute("INSERT INTO foo (x) VALUES (?)", [123])
38
+ conn.commit()
39
+
40
+ cur.execute("SELECT x FROM foo")
41
+ print(cur.fetchall()) # [(123,)]
42
+ ```
43
+
44
+ The database is the path of the file (it's created if it doesn't exist), or
45
+ `:memory:` for a database that only exists for the life of the connection.
46
+ Leaving the `with` block commits (or rolls back if there was an exception) and
47
+ closes the connection.
48
+
49
+ See [example/main.py](example/main.py) for a complete program:
50
+
51
+ ```sh
52
+ python example/main.py
53
+ ```
54
+
55
+ ## Transactions
56
+
57
+ As PEP 249 requires, autocommit is off: the first statement starts a
58
+ transaction, which is ended by `conn.commit()` or `conn.rollback()` (closing
59
+ the connection rolls it back). With `vsql.connect(..., autocommit=True)` (or
60
+ `conn.autocommit = True`), each statement is committed when it finishes, or
61
+ when all the rows of a query have been fetched. `START TRANSACTION`, `COMMIT`
62
+ and `ROLLBACK` can't be executed as statements.
63
+
64
+ vsql's transactions are `READ COMMITTED`.
65
+
66
+ ## Parameters
67
+
68
+ Parameters are `?` (`paramstyle` is `"qmark"`), given as a sequence. Each
69
+ Python type is sent as an SQL type, which is cast to the type it's used as:
70
+
71
+ | Python | SQL |
72
+ |---------------------------|----------------------------------------------|
73
+ | `None` | `NULL` |
74
+ | `bool` | `BOOLEAN` |
75
+ | `int` | `BIGINT` (`NUMERIC` if it's out of range) |
76
+ | `float` | `DOUBLE PRECISION` |
77
+ | `str` | `CHARACTER VARYING` |
78
+ | `decimal.Decimal` | `NUMERIC` (it must be finite) |
79
+ | `datetime.datetime` | `TIMESTAMP(6)` (`WITH TIME ZONE` if aware) |
80
+ | `datetime.date` | `DATE` |
81
+ | `datetime.time` | `TIME(6)` (`WITH TIME ZONE` if aware) |
82
+
83
+ vsql doesn't have a binary type, so `bytes` can't be a parameter.
84
+
85
+ ## Columns
86
+
87
+ | SQL | Python |
88
+ |----------------------------------|---------------------|
89
+ | `SMALLINT`, `INTEGER`, `BIGINT` | `int` |
90
+ | `REAL`, `DOUBLE PRECISION` | `float` |
91
+ | `DECIMAL`, `NUMERIC` | `decimal.Decimal` |
92
+ | `CHARACTER`, `VARCHAR` | `str` |
93
+ | `BOOLEAN` | `bool` |
94
+ | `DATE` | `datetime.date` |
95
+ | `TIME (WITH TIME ZONE)` | `datetime.time` |
96
+ | `TIMESTAMP (WITH TIME ZONE)` | `datetime.datetime` |
97
+
98
+ A `NULL` is `None`. A value `WITH TIME ZONE` is aware (with a fixed offset),
99
+ otherwise it's naive. The `type_code` in `cursor.description` is the name of
100
+ the type (such as `"INTEGER"`), which compares equal to `vsql.NUMBER`,
101
+ `vsql.STRING` or `vsql.DATETIME`.
102
+
103
+ ## Errors
104
+
105
+ An error from vsql is the PEP 249 exception for its SQLSTATE, with the
106
+ SQLSTATE as `sqlstate`:
107
+
108
+ ```python
109
+ try:
110
+ cur.execute("SELECT * FROM nope")
111
+ except vsql.ProgrammingError as e:
112
+ print(e.sqlstate) # 42P01
113
+ ```
114
+
115
+ | SQLSTATE class | Exception |
116
+ |------------------------------------------------|---------------------|
117
+ | `22` data exception | `DataError` |
118
+ | `23` integrity constraint violation | `IntegrityError` |
119
+ | `42` syntax error or access rule violation, `07`, `21`, `24`, `26`, `2B`, `34`, `3D`, `3F` | `ProgrammingError` |
120
+ | `0A` feature not supported, `HYC00` | `NotSupportedError` |
121
+ | `08`, `0B`, `25`, `2D`, `40`, `54`, `58`, `HY001` | `OperationalError` |
122
+ | `HY` CLI-specific condition | `InterfaceError` |
123
+ | `XX` internal error | `InternalError` |
124
+ | anything else | `DatabaseError` |
125
+
126
+ ## Threads
127
+
128
+ Each connection has its own libvsql environment, so different connections can
129
+ be used from different threads at the same time (`threadsafety` is 1: threads
130
+ can share the module, but not connections). The GIL is released while libvsql
131
+ runs.
132
+
133
+ ## Requirements
134
+
135
+ Python 3.9 or later. Wheels are built for macOS (ARM64 and x86-64), Linux
136
+ (ARM64 and x86-64) and Windows (x86-64), so pip doesn't need to compile
137
+ anything.
138
+
139
+ Building from the source distribution needs a C compiler, and takes about 30
140
+ seconds. On Windows, it needs clang-cl (from [LLVM](https://llvm.org), or the
141
+ "C++ Clang tools for Windows" component of Visual Studio) as well as MSVC, since
142
+ the C that V generates doesn't compile with MSVC. clang-cl is found on the
143
+ `PATH` (or in `C:\Program Files\LLVM\bin`), or set `CC` to its path.
144
+
145
+ ## Updating vsql
146
+
147
+ `internal/amalgamation` is the libvsql C from a vsql release
148
+ (`vsql-VERSION-amalgamation.zip`). To update it to the latest release:
149
+
150
+ ```sh
151
+ scripts/update-amalgamation.sh
152
+ pip install -e . && pytest
153
+ ```
154
+
155
+ Or give a version (`scripts/update-amalgamation.sh v1.2.3`), or a zip that has
156
+ already been downloaded.
@@ -0,0 +1,13 @@
1
+ vsql/__init__.py,sha256=APol4z0vfumXsvGt5tu6EXcZ-ewVlFhGfvos4QpmUcY,5232
2
+ vsql/_connection.py,sha256=GtRs3A32kAX9TuxjZJ47Vb4WG6fk88D-oGtve0n8gZc,11218
3
+ vsql/_convert.py,sha256=lVRNsNnXHrBHe-2-u2AxIcpImp13_ZXM_l3IMwIVxwU,6698
4
+ vsql/_errors.py,sha256=n7cLC66niB8BymmYFI6Hc5uNTR8JHmioo4AApLPghTw,3439
5
+ vsql/_libvsql.c,sha256=Fc57uSk_WqWuBb_19k3sD9wf-e-jfpiHN1gNvtzoKrU,18961
6
+ vsql/_libvsql.cp312-win_amd64.pyd,sha256=7YC97HRbqOAe_yOGJ0pHYU-g2KAl67CWK3AJojwtTuk,3130368
7
+ vsql_python-1.0.0.dist-info/licenses/LICENSE,sha256=6Tg9E0zViSBEUDothA1oBgeHjDdg3aLGJD7r8Q2TMpk,1091
8
+ vsql_python-1.0.0.dist-info/licenses/internal/amalgamation/LICENSE,sha256=HM1_tgP70m6PEWwFmBaDf0EcUkiAVCuB_ngH6m9SGOI,1091
9
+ vsql_python-1.0.0.dist-info/licenses/internal/amalgamation/LICENSE-V,sha256=ne_3nJCm_9nbs2sq4BzhCBpful1zTKkRgr3Pdqe72B8,1104
10
+ vsql_python-1.0.0.dist-info/METADATA,sha256=sT0iqfw97yNg4NhkGF_nbBJ1RbkSl6oyJfY5GKvb2R0,6387
11
+ vsql_python-1.0.0.dist-info/WHEEL,sha256=smAfYAdc4xihz0sI8rUsw5fnCPd2yjYFBM0up6OiEDE,101
12
+ vsql_python-1.0.0.dist-info/top_level.txt,sha256=nT0raSqBlZie_VXG3UhubsXubjyj4rVjUcS_DNbuAnQ,5
13
+ vsql_python-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-win_amd64
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Elliot Chance
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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Elliot Chance
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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019-2024 Alexander Medvednikov
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.
@@ -0,0 +1 @@
1
+ vsql