fastmssql 0.3.5__cp314-cp314-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.

@@ -0,0 +1,401 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastmssql
3
+ Version: 0.3.5
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: Operating System :: OS Independent
8
+ Classifier: Operating System :: Microsoft :: Windows
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Classifier: Operating System :: MacOS
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Rust
20
+ Classifier: Topic :: Database
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Dist: pytest>=7.0 ; extra == 'dev'
23
+ Requires-Dist: pytest-asyncio>=0.21 ; extra == 'dev'
24
+ Requires-Dist: psutil>=5.9.0 ; extra == 'dev'
25
+ Provides-Extra: dev
26
+ License-File: LICENSE
27
+ Summary: A high-performance async Python library for Microsoft SQL Server built on Rust for heavy workloads and low latency.
28
+ Author-email: Riveranda <riverb514@gmail.com>
29
+ License: GPL-3.0-or-later OR Commercial
30
+ Requires-Python: >=3.8
31
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
32
+ Project-URL: Homepage, https://github.com/Rivendael/FastMssql
33
+ Project-URL: Repository, https://github.com/Rivendael/FastMssql
34
+ Project-URL: Bug Tracker, https://github.com/Rivendael/FastMssql/issues
35
+ Project-URL: Documentation, https://github.com/Rivendael/FastMssql#readme
36
+
37
+ # FastMSSQL ⚡
38
+
39
+ FastMSSQL is an async Python library for Microsoft SQL Server (MSSQL), built in Rust.
40
+ Unlike pyodbc or pymssql, it uses a native SQL Server client—no ODBC required—simplifying installation on Windows, macOS, and Linux.
41
+ Great for data ingestion, bulk inserts, and large-scale query workloads.
42
+
43
+ [![PyPI](https://img.shields.io/pypi/v/fastmssql)](https://pypi.org/project/fastmssql/)
44
+ [![Python Versions](https://img.shields.io/pypi/pyversions/fastmssql)](https://pypi.org/project/fastmssql/)
45
+ [![Rust Backend](https://img.shields.io/badge/backend-rust-orange)](https://github.com/Rivendael/pymssql-rs)
46
+ [![Async](https://img.shields.io/badge/async-tokio-blue)](https://github.com/Rivendael/pymssql-rs)
47
+ [![License](https://img.shields.io/badge/license-GPL--3.0%20or%20Commercial-green)](LICENSE)
48
+
49
+
50
+
51
+ ## Contents
52
+
53
+ - Features
54
+ - Installation
55
+ - Quick start
56
+ - Usage
57
+ - Connection options
58
+ - Working with data (query vs execute)
59
+ - Connection pooling
60
+ - SSL/TLS
61
+ - Performance tips
62
+ - Examples & benchmarks
63
+ - Troubleshooting
64
+ - Contributing
65
+ - License
66
+
67
+
68
+ ## Features
69
+
70
+ - High performance: optimized for very high RPS and low overhead
71
+ - Rust core: memory‑safe and reliable, tuned Tokio runtime
72
+ - No ODBC: native SQL Server client, no external drivers needed
73
+ - Connection pooling: bb8‑based, smart defaults (default max_size=10, min_idle=2)
74
+ - Async first: clean async/await API with `async with` context managers
75
+ - Strong typing: fast conversions for common SQL Server types
76
+ - Thread‑safe: safe to use in concurrent apps
77
+ - Cross‑platform: Windows, macOS, Linux
78
+ - Batch operations: high-performance bulk inserts and batch query execution
79
+
80
+
81
+ ## Key API methods
82
+
83
+ Core methods for individual operations:
84
+
85
+ - `query()` — SELECT statements that return rows
86
+ - `execute()` — INSERT/UPDATE/DELETE/DDL that return affected row count
87
+
88
+ ```python
89
+ # Use query() for SELECT statements
90
+ result = await conn.query("SELECT * FROM users WHERE age > @P1", [25])
91
+ rows = result.rows()
92
+
93
+ # Use execute() for data modification
94
+ affected = await conn.execute("INSERT INTO users (name) VALUES (@P1)", ["John"])
95
+ ```
96
+
97
+
98
+ ## Installation
99
+
100
+ ### From PyPI (recommended)
101
+
102
+ ```bash
103
+ pip install fastmssql
104
+ ```
105
+
106
+ ### Prerequisites
107
+
108
+ - Python 3.8 to 3.14
109
+ - Microsoft SQL Server (any recent version)
110
+
111
+ ### From source (development)
112
+
113
+ ```bash
114
+ git clone <your-repo-url>
115
+ cd pymssql-rs
116
+ ./setup.sh
117
+ ```
118
+
119
+
120
+ ## Quick start
121
+
122
+ ### Basic async usage
123
+
124
+ ```python
125
+ import asyncio
126
+ from fastmssql import Connection
127
+
128
+ async def main():
129
+ conn_str = "Server=localhost;Database=master;User Id=myuser;Password=mypass"
130
+ async with Connection(conn_str) as conn:
131
+ # SELECT: use query() -> rows()
132
+ result = await conn.query("SELECT @@VERSION as version")
133
+ for row in result.rows():
134
+ print(row['version'])
135
+
136
+ # Pool statistics (tuple: connected, connections, idle, max_size, min_idle)
137
+ connected, connections, idle, max_size, min_idle = await conn.pool_stats()
138
+ print(f"Pool: connected={connected}, size={connections}/{max_size}, idle={idle}, min_idle={min_idle}")
139
+
140
+ asyncio.run(main())
141
+ ```
142
+
143
+
144
+ ## Usage
145
+
146
+ ### Connection options
147
+
148
+ You can connect either with a connection string or individual parameters.
149
+
150
+ 1) Connection string
151
+
152
+ ```python
153
+ import asyncio
154
+ from fastmssql import Connection
155
+
156
+ async def main():
157
+ conn_str = "Server=localhost;Database=master;User Id=myuser;Password=mypass"
158
+ async with Connection(connection_string=conn_str) as conn:
159
+ rows = (await conn.query("SELECT DB_NAME() as db")).rows()
160
+ print(rows[0]['db'])
161
+
162
+ asyncio.run(main())
163
+ ```
164
+
165
+ 2) Individual parameters
166
+
167
+ ```python
168
+ import asyncio
169
+ from fastmssql import Connection
170
+
171
+ async def main():
172
+ async with Connection(
173
+ server="localhost",
174
+ database="master",
175
+ username="myuser",
176
+ password="mypassword"
177
+ ) as conn:
178
+ rows = (await conn.query("SELECT SUSER_SID() as sid")).rows()
179
+ print(rows[0]['sid'])
180
+
181
+ asyncio.run(main())
182
+ ```
183
+
184
+ Note: Windows authentication (Trusted Connection) is currently not supported. Use SQL authentication (username/password).
185
+
186
+
187
+ ### Working with data
188
+
189
+ ```python
190
+ import asyncio
191
+ from fastmssql import Connection
192
+
193
+ async def main():
194
+ async with Connection("Server=.;Database=MyDB;User Id=sa;Password=StrongPwd;") as conn:
195
+ # SELECT (returns rows)
196
+ users = (await conn.query(
197
+ "SELECT id, name, email FROM users WHERE active = 1"
198
+ )).rows()
199
+ for u in users:
200
+ print(f"User {u['id']}: {u['name']} ({u['email']})")
201
+
202
+ # INSERT / UPDATE / DELETE (returns affected row count)
203
+ inserted = await conn.execute(
204
+ "INSERT INTO users (name, email) VALUES (@P1, @P2)",
205
+ ["Jane", "jane@example.com"],
206
+ )
207
+ print(f"Inserted {inserted} row(s)")
208
+
209
+ updated = await conn.execute(
210
+ "UPDATE users SET last_login = GETDATE() WHERE id = @P1",
211
+ [123],
212
+ )
213
+ print(f"Updated {updated} row(s)")
214
+
215
+ asyncio.run(main())
216
+ ```
217
+
218
+ Parameters use positional placeholders: `@P1`, `@P2`, ... Provide values as a list in the same order.
219
+
220
+
221
+ ### Batch operations
222
+
223
+ For high-throughput scenarios, use batch methods to reduce network round-trips:
224
+
225
+ ```python
226
+ import asyncio
227
+ from fastmssql import Connection
228
+
229
+ async def main():
230
+ async with Connection("Server=.;Database=MyDB;User Id=sa;Password=StrongPwd;") as conn:
231
+ # Bulk insert for fast data loading
232
+ columns = ["name", "email", "age"]
233
+ data_rows = [
234
+ ["Alice Johnson", "alice@example.com", 28],
235
+ ["Bob Smith", "bob@example.com", 32],
236
+ ["Carol Davis", "carol@example.com", 25]
237
+ ]
238
+
239
+ rows_inserted = await conn.bulk_insert("users", columns, data_rows)
240
+ print(f"Bulk inserted {rows_inserted} rows")
241
+
242
+ # Batch queries for multiple SELECT operations
243
+ queries = [
244
+ ("SELECT COUNT(*) as total FROM users WHERE age > @P1", [25]),
245
+ ("SELECT AVG(age) as avg_age FROM users", None),
246
+ ("SELECT name FROM users WHERE email LIKE @P1", ["%@example.com"])
247
+ ]
248
+
249
+ results = await conn.query_batch(queries)
250
+ print(f"Total users over 25: {results[0].rows()[0]['total']}")
251
+ print(f"Average age: {results[1].rows()[0]['avg_age']:.1f}")
252
+ print(f"Example.com users: {len(results[2].rows())}")
253
+
254
+ # Batch commands for multiple operations
255
+ commands = [
256
+ ("UPDATE users SET last_login = GETDATE() WHERE name = @P1", ["Alice Johnson"]),
257
+ ("INSERT INTO user_logs (action, user_name) VALUES (@P1, @P2)", ["login", "Alice Johnson"])
258
+ ]
259
+
260
+ affected_counts = await conn.execute_batch(commands)
261
+ print(f"Updated {affected_counts[0]} users, inserted {affected_counts[1]} logs")
262
+
263
+ asyncio.run(main())
264
+ ```
265
+
266
+
267
+ ### Connection strings
268
+
269
+ ```python
270
+ # SQL Server Authentication
271
+ conn_str = "Server=localhost;Database=MyDB;User Id=sa;Password=MyPassword"
272
+
273
+ # With specific port
274
+ conn_str = "Server=localhost,1433;Database=MyDB;User Id=myuser;Password=mypass"
275
+
276
+ # Azure SQL Database (encryption recommended)
277
+ conn_str = "Server=tcp:myserver.database.windows.net,1433;Database=MyDB;User Id=myuser;Password=mypass;Encrypt=true"
278
+ ```
279
+
280
+
281
+ ### Connection pooling
282
+
283
+ Tune the pool to fit your workload. Constructor signature:
284
+
285
+ ```python
286
+ from fastmssql import PoolConfig
287
+
288
+ # PoolConfig(max_size=10, min_idle=2, max_lifetime_secs=None, idle_timeout_secs=None, connection_timeout_secs=30)
289
+ config = PoolConfig(
290
+ max_size=20, # max connections in pool
291
+ min_idle=5, # keep at least this many idle
292
+ max_lifetime_secs=3600, # recycle connections after 1h
293
+ idle_timeout_secs=600, # close idle connections after 10m
294
+ connection_timeout_secs=30
295
+ )
296
+ ```
297
+
298
+ Presets:
299
+
300
+ ```python
301
+ high = PoolConfig.high_throughput() # ~ max_size=50, min_idle=15
302
+ low = PoolConfig.low_resource() # ~ max_size=3, min_idle=1
303
+ dev = PoolConfig.development() # ~ max_size=5, min_idle=1
304
+ maxp = PoolConfig.maximum_performance() # ~ max_size=100, min_idle=30
305
+ ultra = PoolConfig.ultra_high_concurrency() # ~ max_size=200, min_idle=50
306
+ ```
307
+
308
+ Apply to a connection:
309
+
310
+ ```python
311
+ async with Connection(conn_str, pool_config=high) as conn:
312
+ rows = (await conn.query("SELECT 1 AS ok")).rows()
313
+ ```
314
+
315
+ Default pool (if omitted): `max_size=10`, `min_idle=2`.
316
+
317
+
318
+ ### SSL/TLS
319
+
320
+ ```python
321
+ from fastmssql import SslConfig, EncryptionLevel, Connection
322
+
323
+ ssl = SslConfig(
324
+ encryption_level=EncryptionLevel.REQUIRED, # or "Required"
325
+ trust_server_certificate=False,
326
+ )
327
+
328
+ async with Connection(conn_str, ssl_config=ssl) as conn:
329
+ ...
330
+ ```
331
+
332
+ Helpers:
333
+
334
+ - `SslConfig.development()` – encrypt, trust all (dev only)
335
+ - `SslConfig.with_ca_certificate(path)` – use custom CA
336
+ - `SslConfig.login_only()` / `SslConfig.disabled()` – legacy modes
337
+
338
+
339
+ ## Performance tips
340
+
341
+ For maximum throughput in highly concurrent scenarios, use multiple `Connection` instances (each with its own pool) and batch your work:
342
+
343
+ ```python
344
+ import asyncio
345
+ from fastmssql import Connection, PoolConfig
346
+
347
+ async def worker(conn_str, cfg):
348
+ async with Connection(conn_str, pool_config=cfg) as conn:
349
+ for _ in range(1000):
350
+ _ = (await conn.query("SELECT 1 as v")).rows()
351
+
352
+ async def main():
353
+ conn_str = "Server=.;Database=master;User Id=sa;Password=StrongPwd;"
354
+ cfg = PoolConfig.high_throughput()
355
+ await asyncio.gather(*[asyncio.create_task(worker(conn_str, cfg)) for _ in range(32)])
356
+
357
+ asyncio.run(main())
358
+ ```
359
+
360
+
361
+ ## Examples & benchmarks
362
+
363
+ - Examples: `examples/comprehensive_example.py`
364
+ - Benchmarks: `benchmarks/` (MIT licensed)
365
+
366
+
367
+ ## Troubleshooting
368
+
369
+ - Import/build: ensure Rust toolchain and `maturin` are installed if building from source
370
+ - Connection: verify connection string; Windows auth not supported
371
+ - Timeouts: increase pool size or tune `connection_timeout_secs`
372
+ - Parameters: use `@P1, @P2, ...` and pass a list of values
373
+
374
+
375
+ ## Contributing
376
+
377
+ Contributions are welcome. Please open an issue or PR.
378
+
379
+
380
+ ## License
381
+
382
+ FastMSSQL is dual‑licensed:
383
+
384
+ - GPL‑3.0 (for open source projects)
385
+ - Commercial (for proprietary use). Contact: riverb514@gmail.com
386
+
387
+ See the [LICENSE](LICENSE) file for details.
388
+
389
+ ### Examples and Benchmarks
390
+
391
+ - `examples/` and `benchmarks/` are under the MIT License. See files in `licenses/`.
392
+
393
+
394
+ ## Third‑party attributions
395
+
396
+ 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/`.
397
+
398
+
399
+ ## Acknowledgments
400
+
401
+ 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.5.dist-info/RECORD,,
2
+ fastmssql-0.3.5.dist-info/WHEEL,sha256=Dfn9zUatNC9j13ABUHNgyZmkyHCncipEw4RIexPnpdI,132
3
+ fastmssql-0.3.5.dist-info/METADATA,sha256=TRFFzjXftcC7pIT545HvBnDXCudyYue8WNAgKg7hyp4,12431
4
+ fastmssql-0.3.5.dist-info/licenses/LICENSE,sha256=OHj2nKice3tSk2Us200EWXDpwDKtAzeOu4NF4rwg5gk,33858
5
+ fastmssql/fastmssql.cpython-314-darwin.so,sha256=hDwc2ixIhQkUHOSfpgxTrLpxI6y9kYqQ6RtjfjAEamU,2052720
6
+ fastmssql/__init__.py,sha256=H2sCgkVlgRo3oIbejLqnHUIsFCqcbJIc20TJ4CCPkQo,43543
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.9.4)
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314-macosx_11_0_arm64
5
+ Generator: delocate 0.13.0
6
+