fastmssql 0.2.9__cp312-cp312-macosx_11_0_arm64.whl → 0.3.2__cp312-cp312-macosx_11_0_arm64.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.
Potentially problematic release.
This version of fastmssql might be problematic. Click here for more details.
- fastmssql/fastmssql.cpython-312-darwin.so +0 -0
- fastmssql-0.3.2.dist-info/METADATA +346 -0
- fastmssql-0.3.2.dist-info/RECORD +6 -0
- {fastmssql-0.2.9.dist-info → fastmssql-0.3.2.dist-info}/WHEEL +2 -0
- fastmssql-0.3.2.dist-info/licenses/LICENSE +675 -0
- fastmssql-0.2.9.dist-info/METADATA +0 -788
- fastmssql-0.2.9.dist-info/RECORD +0 -6
- fastmssql-0.2.9.dist-info/licenses/LICENSE +0 -139
|
Binary file
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastmssql
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Rust
|
|
15
|
+
Classifier: Topic :: Database
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
18
|
+
Requires-Dist: pytest-asyncio>=0.21 ; extra == 'dev'
|
|
19
|
+
Requires-Dist: psutil>=5.9.0 ; extra == 'dev'
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Summary: A high-performance async Python library for Microsoft SQL Server built on Rust for heavy workloads and low latency.
|
|
23
|
+
Author-email: Riveranda <riverb514@gmail.com>
|
|
24
|
+
License: GPL-3.0-or-later OR Commercial
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
27
|
+
Project-URL: Homepage, https://github.com/Rivendael/pymssql-rs
|
|
28
|
+
|
|
29
|
+
# FastMSSQL ⚡
|
|
30
|
+
|
|
31
|
+
FastMSSQL is an async Python library for Microsoft SQL Server (MSSQL), built in Rust.
|
|
32
|
+
Unlike pyodbc or pymssql, it uses a native SQL Server client—no ODBC required—simplifying installation on Windows, macOS, and Linux.
|
|
33
|
+
Great for data ingestion, bulk inserts, and large-scale query workloads.
|
|
34
|
+
|
|
35
|
+
[](https://pypi.org/project/fastmssql/)
|
|
36
|
+
[](https://pypi.org/project/fastmssql/)
|
|
37
|
+
[](https://github.com/Rivendael/pymssql-rs)
|
|
38
|
+
[](https://github.com/Rivendael/pymssql-rs)
|
|
39
|
+
[](LICENSE)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## Contents
|
|
44
|
+
|
|
45
|
+
- Features
|
|
46
|
+
- Installation
|
|
47
|
+
- Quick start
|
|
48
|
+
- Usage
|
|
49
|
+
- Connection options
|
|
50
|
+
- Working with data (query vs execute)
|
|
51
|
+
- Connection pooling
|
|
52
|
+
- SSL/TLS
|
|
53
|
+
- Performance tips
|
|
54
|
+
- Examples & benchmarks
|
|
55
|
+
- Troubleshooting
|
|
56
|
+
- Contributing
|
|
57
|
+
- License
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Features
|
|
61
|
+
|
|
62
|
+
- High performance: optimized for very high RPS and low overhead
|
|
63
|
+
- Rust core: memory‑safe and reliable, tuned Tokio runtime
|
|
64
|
+
- No ODBC: native SQL Server client, no external drivers needed
|
|
65
|
+
- Connection pooling: bb8‑based, smart defaults (default max_size=10, min_idle=2)
|
|
66
|
+
- Async first: clean async/await API with `async with` context managers
|
|
67
|
+
- Strong typing: fast conversions for common SQL Server types
|
|
68
|
+
- Thread‑safe: safe to use in concurrent apps
|
|
69
|
+
- Cross‑platform: Windows, macOS, Linux
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## Key API methods
|
|
73
|
+
|
|
74
|
+
Two focused methods cover most use cases:
|
|
75
|
+
|
|
76
|
+
- `query()` — SELECT statements that return rows
|
|
77
|
+
- `execute()` — INSERT/UPDATE/DELETE/DDL that return affected row count
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
# Use query() for SELECT statements
|
|
81
|
+
result = await conn.query("SELECT * FROM users WHERE age > @P1", [25])
|
|
82
|
+
rows = result.rows()
|
|
83
|
+
|
|
84
|
+
# Use execute() for data modification
|
|
85
|
+
affected = await conn.execute("INSERT INTO users (name) VALUES (@P1)", ["John"])
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Installation
|
|
90
|
+
|
|
91
|
+
### From PyPI (recommended)
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install fastmssql
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Prerequisites
|
|
98
|
+
|
|
99
|
+
- Python 3.8 to 3.13
|
|
100
|
+
- Microsoft SQL Server (any recent version)
|
|
101
|
+
|
|
102
|
+
### From source (development)
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git clone <your-repo-url>
|
|
106
|
+
cd pymssql-rs
|
|
107
|
+
./setup.sh
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## Quick start
|
|
112
|
+
|
|
113
|
+
### Basic async usage
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
import asyncio
|
|
117
|
+
from fastmssql import Connection
|
|
118
|
+
|
|
119
|
+
async def main():
|
|
120
|
+
conn_str = "Server=localhost;Database=master;User Id=myuser;Password=mypass"
|
|
121
|
+
async with Connection(conn_str) as conn:
|
|
122
|
+
# SELECT: use query() -> rows()
|
|
123
|
+
result = await conn.query("SELECT @@VERSION as version")
|
|
124
|
+
for row in result.rows():
|
|
125
|
+
print(row['version'])
|
|
126
|
+
|
|
127
|
+
# Pool statistics (tuple: connected, connections, idle, max_size, min_idle)
|
|
128
|
+
connected, connections, idle, max_size, min_idle = await conn.pool_stats()
|
|
129
|
+
print(f"Pool: connected={connected}, size={connections}/{max_size}, idle={idle}, min_idle={min_idle}")
|
|
130
|
+
|
|
131
|
+
asyncio.run(main())
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
## Usage
|
|
136
|
+
|
|
137
|
+
### Connection options
|
|
138
|
+
|
|
139
|
+
You can connect either with a connection string or individual parameters.
|
|
140
|
+
|
|
141
|
+
1) Connection string
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
import asyncio
|
|
145
|
+
from fastmssql import Connection
|
|
146
|
+
|
|
147
|
+
async def main():
|
|
148
|
+
conn_str = "Server=localhost;Database=master;User Id=myuser;Password=mypass"
|
|
149
|
+
async with Connection(connection_string=conn_str) as conn:
|
|
150
|
+
rows = (await conn.query("SELECT DB_NAME() as db")).rows()
|
|
151
|
+
print(rows[0]['db'])
|
|
152
|
+
|
|
153
|
+
asyncio.run(main())
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
2) Individual parameters
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
import asyncio
|
|
160
|
+
from fastmssql import Connection
|
|
161
|
+
|
|
162
|
+
async def main():
|
|
163
|
+
async with Connection(
|
|
164
|
+
server="localhost",
|
|
165
|
+
database="master",
|
|
166
|
+
username="myuser",
|
|
167
|
+
password="mypassword"
|
|
168
|
+
) as conn:
|
|
169
|
+
rows = (await conn.query("SELECT SUSER_SID() as sid")).rows()
|
|
170
|
+
print(rows[0]['sid'])
|
|
171
|
+
|
|
172
|
+
asyncio.run(main())
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Note: Windows authentication (Trusted Connection) is currently not supported. Use SQL authentication (username/password).
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
### Working with data
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
import asyncio
|
|
182
|
+
from fastmssql import Connection
|
|
183
|
+
|
|
184
|
+
async def main():
|
|
185
|
+
async with Connection("Server=.;Database=MyDB;User Id=sa;Password=StrongPwd;") as conn:
|
|
186
|
+
# SELECT (returns rows)
|
|
187
|
+
users = (await conn.query(
|
|
188
|
+
"SELECT id, name, email FROM users WHERE active = 1"
|
|
189
|
+
)).rows()
|
|
190
|
+
for u in users:
|
|
191
|
+
print(f"User {u['id']}: {u['name']} ({u['email']})")
|
|
192
|
+
|
|
193
|
+
# INSERT / UPDATE / DELETE (returns affected row count)
|
|
194
|
+
inserted = await conn.execute(
|
|
195
|
+
"INSERT INTO users (name, email) VALUES (@P1, @P2)",
|
|
196
|
+
["Jane", "jane@example.com"],
|
|
197
|
+
)
|
|
198
|
+
print(f"Inserted {inserted} row(s)")
|
|
199
|
+
|
|
200
|
+
updated = await conn.execute(
|
|
201
|
+
"UPDATE users SET last_login = GETDATE() WHERE id = @P1",
|
|
202
|
+
[123],
|
|
203
|
+
)
|
|
204
|
+
print(f"Updated {updated} row(s)")
|
|
205
|
+
|
|
206
|
+
asyncio.run(main())
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Parameters use positional placeholders: `@P1`, `@P2`, ... Provide values as a list in the same order.
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
### Connection strings
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
# SQL Server Authentication
|
|
216
|
+
conn_str = "Server=localhost;Database=MyDB;User Id=sa;Password=MyPassword"
|
|
217
|
+
|
|
218
|
+
# With specific port
|
|
219
|
+
conn_str = "Server=localhost,1433;Database=MyDB;User Id=myuser;Password=mypass"
|
|
220
|
+
|
|
221
|
+
# Azure SQL Database (encryption recommended)
|
|
222
|
+
conn_str = "Server=tcp:myserver.database.windows.net,1433;Database=MyDB;User Id=myuser;Password=mypass;Encrypt=true"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
### Connection pooling
|
|
227
|
+
|
|
228
|
+
Tune the pool to fit your workload. Constructor signature:
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
from fastmssql import PoolConfig
|
|
232
|
+
|
|
233
|
+
# PoolConfig(max_size=10, min_idle=2, max_lifetime_secs=None, idle_timeout_secs=None, connection_timeout_secs=30)
|
|
234
|
+
config = PoolConfig(
|
|
235
|
+
max_size=20, # max connections in pool
|
|
236
|
+
min_idle=5, # keep at least this many idle
|
|
237
|
+
max_lifetime_secs=3600, # recycle connections after 1h
|
|
238
|
+
idle_timeout_secs=600, # close idle connections after 10m
|
|
239
|
+
connection_timeout_secs=30
|
|
240
|
+
)
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Presets:
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
high = PoolConfig.high_throughput() # ~ max_size=50, min_idle=15
|
|
247
|
+
low = PoolConfig.low_resource() # ~ max_size=3, min_idle=1
|
|
248
|
+
dev = PoolConfig.development() # ~ max_size=5, min_idle=1
|
|
249
|
+
maxp = PoolConfig.maximum_performance() # ~ max_size=100, min_idle=30
|
|
250
|
+
ultra = PoolConfig.ultra_high_concurrency() # ~ max_size=200, min_idle=50
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Apply to a connection:
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
async with Connection(conn_str, pool_config=high) as conn:
|
|
257
|
+
rows = (await conn.query("SELECT 1 AS ok")).rows()
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Default pool (if omitted): `max_size=10`, `min_idle=2`.
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
### SSL/TLS
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
from fastmssql import SslConfig, EncryptionLevel, Connection
|
|
267
|
+
|
|
268
|
+
ssl = SslConfig(
|
|
269
|
+
encryption_level=EncryptionLevel.REQUIRED, # or "Required"
|
|
270
|
+
trust_server_certificate=False,
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
async with Connection(conn_str, ssl_config=ssl) as conn:
|
|
274
|
+
...
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Helpers:
|
|
278
|
+
|
|
279
|
+
- `SslConfig.development()` – encrypt, trust all (dev only)
|
|
280
|
+
- `SslConfig.with_ca_certificate(path)` – use custom CA
|
|
281
|
+
- `SslConfig.login_only()` / `SslConfig.disabled()` – legacy modes
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
## Performance tips
|
|
285
|
+
|
|
286
|
+
For maximum throughput in highly concurrent scenarios, use multiple `Connection` instances (each with its own pool) and batch your work:
|
|
287
|
+
|
|
288
|
+
```python
|
|
289
|
+
import asyncio
|
|
290
|
+
from fastmssql import Connection, PoolConfig
|
|
291
|
+
|
|
292
|
+
async def worker(conn_str, cfg):
|
|
293
|
+
async with Connection(conn_str, pool_config=cfg) as conn:
|
|
294
|
+
for _ in range(1000):
|
|
295
|
+
_ = (await conn.query("SELECT 1 as v")).rows()
|
|
296
|
+
|
|
297
|
+
async def main():
|
|
298
|
+
conn_str = "Server=.;Database=master;User Id=sa;Password=StrongPwd;"
|
|
299
|
+
cfg = PoolConfig.high_throughput()
|
|
300
|
+
await asyncio.gather(*[asyncio.create_task(worker(conn_str, cfg)) for _ in range(32)])
|
|
301
|
+
|
|
302
|
+
asyncio.run(main())
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
## Examples & benchmarks
|
|
307
|
+
|
|
308
|
+
- Examples: `examples/comprehensive_example.py`
|
|
309
|
+
- Benchmarks: `benchmarks/` (MIT licensed)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
## Troubleshooting
|
|
313
|
+
|
|
314
|
+
- Import/build: ensure Rust toolchain and `maturin` are installed if building from source
|
|
315
|
+
- Connection: verify connection string; Windows auth not supported
|
|
316
|
+
- Timeouts: increase pool size or tune `connection_timeout_secs`
|
|
317
|
+
- Parameters: use `@P1, @P2, ...` and pass a list of values
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
## Contributing
|
|
321
|
+
|
|
322
|
+
Contributions are welcome. Please open an issue or PR.
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
## License
|
|
326
|
+
|
|
327
|
+
FastMSSQL is dual‑licensed:
|
|
328
|
+
|
|
329
|
+
- GPL‑3.0 (for open source projects)
|
|
330
|
+
- Commercial (for proprietary use). Contact: riverb514@gmail.com
|
|
331
|
+
|
|
332
|
+
See the [LICENSE](LICENSE) file for details.
|
|
333
|
+
|
|
334
|
+
### Examples and Benchmarks
|
|
335
|
+
|
|
336
|
+
- `examples/` and `benchmarks/` are under the MIT License. See files in `licenses/`.
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
## Third‑party attributions
|
|
340
|
+
|
|
341
|
+
Built on excellent open source projects: Tiberius, PyO3, pyo3‑asyncio, bb8, tokio, serde, pytest, maturin, and more. See `licenses/NOTICE.txt` for the full list. The full texts of Apache‑2.0 and MIT are in `licenses/`.
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
## Acknowledgments
|
|
345
|
+
|
|
346
|
+
Thanks to the maintainers of Tiberius, PyO3, pyo3‑asyncio, Tokio, pytest, maturin, and the broader open source community.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
fastmssql-0.3.2.dist-info/RECORD,,
|
|
2
|
+
fastmssql-0.3.2.dist-info/WHEEL,sha256=ZtnnoQYaQEP2GKpSrXueQx-dbzNKpOtIl9MDW0BQEi4,132
|
|
3
|
+
fastmssql-0.3.2.dist-info/METADATA,sha256=-QFPw7BapAZLIykvsOkYX90ubR8PoAgl3ARZc_TNUaU,10182
|
|
4
|
+
fastmssql-0.3.2.dist-info/licenses/LICENSE,sha256=OHj2nKice3tSk2Us200EWXDpwDKtAzeOu4NF4rwg5gk,33858
|
|
5
|
+
fastmssql/fastmssql.cpython-312-darwin.so,sha256=ZmrD8oR-s_aotvGGvMiIlJYhjjDXIK_33udGF5q9CXQ,1986016
|
|
6
|
+
fastmssql/__init__.py,sha256=pFvT4Iki4PdpHWl3APWVeXccWxakueCkU57jbEKcIDA,30407
|