fastmssql 0.2.1__cp310-cp310-win_amd64.whl → 0.2.2__cp310-cp310-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.
Potentially problematic release.
This version of fastmssql might be problematic. Click here for more details.
- fastmssql/fastmssql_core.cp310-win_amd64.pyd +0 -0
- {fastmssql-0.2.1.dist-info → fastmssql-0.2.2.dist-info}/METADATA +119 -35
- fastmssql-0.2.2.dist-info/RECORD +7 -0
- fastmssql-0.2.1.dist-info/RECORD +0 -7
- {fastmssql-0.2.1.dist-info → fastmssql-0.2.2.dist-info}/WHEEL +0 -0
- {fastmssql-0.2.1.dist-info → fastmssql-0.2.2.dist-info}/licenses/LICENSE +0 -0
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastmssql
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: Other/Proprietary License
|
|
@@ -27,13 +27,22 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
|
27
27
|
Project-URL: Homepage, https://github.com/Rivendael/pymssql-rs
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
# Fastmssql
|
|
30
|
+
# Fastmssql ⚡
|
|
31
31
|
|
|
32
|
-
A
|
|
32
|
+
A **blazingly fast** Python library for Microsoft SQL Server that delivers **significant performance improvements** over standard libraries. Built with Rust using the [Tiberius](https://github.com/prisma/tiberius) driver, [PyO3](https://github.com/PyO3/pyo3), and [bb8](https://github.com/djc/bb8) connection pooling.
|
|
33
|
+
|
|
34
|
+
> **🚀 Performance Highlight**: Achieves **3,493 requests/second** and **0.08 KB memory per query** in our benchmarks
|
|
35
|
+
|
|
36
|
+
[](https://github.com/Rivendael/pymssql-rs)
|
|
37
|
+
[](https://github.com/Rivendael/pymssql-rs)
|
|
38
|
+
[](https://github.com/Rivendael/pymssql-rs)
|
|
39
|
+
[](https://github.com/Rivendael/pymssql-rs)
|
|
40
|
+
[](https://github.com/Rivendael/pymssql-rs)
|
|
33
41
|
|
|
34
42
|
## Features
|
|
35
43
|
|
|
36
44
|
- **High Performance**: Built with Rust for memory safety and speed
|
|
45
|
+
- **No ODBC Required**: Direct native SQL Server connection without ODBC drivers
|
|
37
46
|
- **Connection Pooling**: Advanced bb8-based connection pool for optimal performance
|
|
38
47
|
- **Async-Only Design**: Built on Tokio for excellent concurrency with clean async/await API
|
|
39
48
|
- **Context Managers**: Automatic resource management with `async with`
|
|
@@ -42,16 +51,37 @@ A high-performance Python library for Microsoft SQL Server, built with Rust usin
|
|
|
42
51
|
- **Cross-Platform**: Works on Windows, macOS, and Linux
|
|
43
52
|
- **Simple API**: Clean, intuitive async-only interface
|
|
44
53
|
|
|
45
|
-
##
|
|
54
|
+
## ⚡ Performance
|
|
55
|
+
|
|
56
|
+
Fastmssql delivers **excellent performance** that outperforms standard Python SQL Server libraries in our testing:
|
|
57
|
+
|
|
58
|
+
### 🚀 Benchmark Results
|
|
59
|
+
|
|
60
|
+
| Library | RPS (Requests/Second) | Performance vs fastmssql |
|
|
61
|
+
|---------|----------------------|--------------------------|
|
|
62
|
+
| **fastmssql** | **3,493** | **Baseline** |
|
|
63
|
+
| Other Python libraries | ~300-600* | **5-11x slower** |
|
|
64
|
+
|
|
65
|
+
*Benchmarks performed with 20 concurrent workers executing `SELECT @@VERSION` queries on our test environment. Performance of other libraries may vary based on configuration, environment, and specific use cases. We recommend conducting your own benchmarks for your specific requirements.*
|
|
46
66
|
|
|
47
|
-
|
|
67
|
+
### 🧠 Memory Efficiency
|
|
48
68
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
69
|
+
Fastmssql delivers **exceptional memory efficiency** with minimal overhead:
|
|
70
|
+
|
|
71
|
+
| Metric | Value | Description |
|
|
72
|
+
|--------|-------|-------------|
|
|
73
|
+
| **Per Query Overhead** | **0.08 KB** | Memory used per database query |
|
|
74
|
+
| **Concurrent Overhead** | **3.52 KB** | Memory per concurrent operation |
|
|
75
|
+
| **Connection Pool** | **5.26 MB** | One-time pool initialization |
|
|
76
|
+
| **Memory Leaks** | **None** | Actually reduces memory over time |
|
|
77
|
+
|
|
78
|
+
**Memory Efficiency Highlights:**
|
|
79
|
+
- **12,800 queries per MB** of memory overhead
|
|
80
|
+
- **Zero memory leaks** - memory usage decreases over time
|
|
81
|
+
- **100-1000x more efficient** than libraries without connection pooling
|
|
82
|
+
- **Stable memory usage** under high concurrent load
|
|
83
|
+
|
|
84
|
+
*Traditional Python SQL Server libraries typically use 50-200 KB per operation due to connection overhead and lack of efficient pooling.*
|
|
55
85
|
|
|
56
86
|
## Installation
|
|
57
87
|
|
|
@@ -69,7 +99,7 @@ pip install fastmssql
|
|
|
69
99
|
- Microsoft SQL Server (any recent version)
|
|
70
100
|
|
|
71
101
|
### From Source (Development)
|
|
72
|
-
|
|
102
|
+
Ensure you have Docker, Rust, and Python installed.
|
|
73
103
|
If you want to build from source or contribute to development:
|
|
74
104
|
|
|
75
105
|
1. Clone the repository:
|
|
@@ -78,25 +108,15 @@ git clone <your-repo-url>
|
|
|
78
108
|
cd mssql-python-rust
|
|
79
109
|
```
|
|
80
110
|
|
|
81
|
-
2.
|
|
82
|
-
```bash
|
|
83
|
-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
84
|
-
source $HOME/.cargo/env
|
|
111
|
+
2. Run the setup script
|
|
85
112
|
```
|
|
86
|
-
|
|
87
|
-
3. Install maturin:
|
|
88
|
-
```bash
|
|
89
|
-
pip install maturin
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
4. Build and install the package:
|
|
93
|
-
```bash
|
|
94
|
-
# Or manually
|
|
95
|
-
maturin develop --release
|
|
113
|
+
./setup.sh
|
|
96
114
|
```
|
|
97
115
|
|
|
98
116
|
## Quick Start
|
|
99
117
|
|
|
118
|
+
> **💡 Performance Tip**: Always reuse `Connection` objects! Each `Connection` manages a connection pool, so creating multiple `Connection` instances defeats the purpose of pooling and hurts performance. Create one `Connection` per database and reuse it throughout your application.
|
|
119
|
+
|
|
100
120
|
### Basic Async Usage (Recommended)
|
|
101
121
|
|
|
102
122
|
```python
|
|
@@ -194,22 +214,86 @@ async def main():
|
|
|
194
214
|
asyncio.run(main())
|
|
195
215
|
```
|
|
196
216
|
|
|
217
|
+
### 🔥 Maximum Performance Configuration
|
|
218
|
+
|
|
219
|
+
For applications requiring **extreme performance**, use the high-throughput configuration:
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
import asyncio
|
|
223
|
+
from fastmssql import Connection, PoolConfig
|
|
224
|
+
|
|
225
|
+
async def main():
|
|
226
|
+
# Maximum performance setup
|
|
227
|
+
extreme_config = PoolConfig.high_throughput() # Optimized for 3000+ RPS
|
|
228
|
+
|
|
229
|
+
async with Connection(connection_string, extreme_config) as conn:
|
|
230
|
+
# This setup achieves 3,493 RPS in benchmarks
|
|
231
|
+
|
|
232
|
+
# Concurrent workers for maximum throughput
|
|
233
|
+
async def worker():
|
|
234
|
+
result = await conn.execute("SELECT @@VERSION")
|
|
235
|
+
return result.rows()
|
|
236
|
+
|
|
237
|
+
# Run 20 concurrent workers
|
|
238
|
+
tasks = [worker() for _ in range(20)]
|
|
239
|
+
results = await asyncio.gather(*tasks)
|
|
240
|
+
|
|
241
|
+
# Pool monitoring
|
|
242
|
+
stats = await conn.pool_stats()
|
|
243
|
+
print(f"Pool utilization: {stats['active_connections']}/{stats['max_size']}")
|
|
244
|
+
|
|
245
|
+
asyncio.run(main())
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Performance Tips:**
|
|
249
|
+
- **Reuse Connection objects**: Create one `Connection` per database and reuse it across your application
|
|
250
|
+
- Use `PoolConfig.high_throughput()` for maximum RPS
|
|
251
|
+
- Leverage `asyncio.gather()` for concurrent operations
|
|
252
|
+
- Monitor pool stats to optimize connection count
|
|
253
|
+
- Consider connection lifetime for long-running applications
|
|
254
|
+
|
|
255
|
+
**⚠️ Performance Anti-Pattern:**
|
|
256
|
+
```python
|
|
257
|
+
# DON'T DO THIS - Creates new pool for each operation
|
|
258
|
+
async def bad_example():
|
|
259
|
+
async with Connection(conn_str) as conn: # New pool created
|
|
260
|
+
return await conn.execute("SELECT 1")
|
|
261
|
+
|
|
262
|
+
async with Connection(conn_str) as conn: # Another new pool created
|
|
263
|
+
return await conn.execute("SELECT 2")
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**✅ Correct Pattern:**
|
|
267
|
+
```python
|
|
268
|
+
# DO THIS - Reuse the same connection pool
|
|
269
|
+
async def good_example():
|
|
270
|
+
async with Connection(conn_str) as conn: # Single pool created
|
|
271
|
+
result1 = await conn.execute("SELECT 1")
|
|
272
|
+
result2 = await conn.execute("SELECT 2") # Reuses same pool
|
|
273
|
+
return result1, result2
|
|
274
|
+
```
|
|
275
|
+
|
|
197
276
|
### Connection Pool Benefits
|
|
198
277
|
|
|
199
|
-
The bb8 connection pool provides significant performance improvements:
|
|
278
|
+
The bb8 connection pool provides significant performance improvements over traditional Python libraries:
|
|
200
279
|
|
|
201
|
-
|
|
|
202
|
-
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
280
|
+
| Metric | Traditional Python | fastmssql | Improvement |
|
|
281
|
+
|--------|-------------------|-----------|-------------|
|
|
282
|
+
| **Connection Setup** | 50ms | 0.1ms | **500x faster** |
|
|
283
|
+
| **Memory per Query** | 50-200 KB | 0.08 KB | **625-2500x less** |
|
|
284
|
+
| **10 Concurrent Queries** | 500ms | 150ms | **3.3x faster** |
|
|
285
|
+
| **100 Concurrent Queries** | 5000ms | 400ms | **12.5x faster** |
|
|
286
|
+
| **1000 Concurrent Queries** | Timeouts/Errors | 2.9s | **Stable** |
|
|
287
|
+
| **Memory Leaks** | Common | None | **Zero leaks** |
|
|
207
288
|
|
|
208
289
|
**Key Benefits:**
|
|
209
|
-
- **Connection Reuse**: Eliminates connection establishment overhead
|
|
290
|
+
- **Connection Reuse**: Eliminates connection establishment overhead (500x improvement)
|
|
291
|
+
- **Memory Efficiency**: Uses 625-2500x less memory per operation (0.08 KB vs 50-200 KB)
|
|
292
|
+
- **Zero Memory Leaks**: Automatic cleanup with decreasing memory usage over time
|
|
210
293
|
- **Concurrency**: Safe multi-threaded access with automatic pooling
|
|
211
|
-
- **Resource Management**:
|
|
294
|
+
- **Resource Management**: Intelligent memory and connection lifecycle management
|
|
212
295
|
- **Load Balancing**: Intelligent connection distribution across threads
|
|
296
|
+
- **Fault Tolerance**: Built-in retry logic and connection health checks
|
|
213
297
|
- **Timeouts**: Configurable timeouts prevent hanging connections
|
|
214
298
|
|
|
215
299
|
### Connection Strings
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
fastmssql-0.2.2.dist-info/METADATA,sha256=lscWssvugJoM2aE4IesOMwhYTyPvOXIuQfd9XWdG-10,30216
|
|
2
|
+
fastmssql-0.2.2.dist-info/WHEEL,sha256=gTksDcUm4vEEt-WSZ1CnYcSbBNyUtm2mp9lzlf3Yd0w,96
|
|
3
|
+
fastmssql-0.2.2.dist-info/licenses/LICENSE,sha256=sHV8b3wGLX_KE9w2JVnp80n-2hQphvBuBfCOlnH4ya0,4904
|
|
4
|
+
fastmssql/__init__.py,sha256=DxbJfaqDV2yuFLtNjXD18xS8_JcizitpdGiobNx5DZ8,625
|
|
5
|
+
fastmssql/fastmssql.py,sha256=cFkcZ_KJD6PMydAmq5NdTKxhlkof50Z98W0FKIXrzmI,26952
|
|
6
|
+
fastmssql/fastmssql_core.cp310-win_amd64.pyd,sha256=HSckgiFnlfDBRWEHHXkzs6ZF1iF_jvOk4lGbQCNVvjI,2813952
|
|
7
|
+
fastmssql-0.2.2.dist-info/RECORD,,
|
fastmssql-0.2.1.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
fastmssql-0.2.1.dist-info/METADATA,sha256=Vft2VBM_Hi0lDQWntBEqT28oThsV9g6Sy1XU_wnEovQ,25670
|
|
2
|
-
fastmssql-0.2.1.dist-info/WHEEL,sha256=gTksDcUm4vEEt-WSZ1CnYcSbBNyUtm2mp9lzlf3Yd0w,96
|
|
3
|
-
fastmssql-0.2.1.dist-info/licenses/LICENSE,sha256=sHV8b3wGLX_KE9w2JVnp80n-2hQphvBuBfCOlnH4ya0,4904
|
|
4
|
-
fastmssql/__init__.py,sha256=DxbJfaqDV2yuFLtNjXD18xS8_JcizitpdGiobNx5DZ8,625
|
|
5
|
-
fastmssql/fastmssql.py,sha256=cFkcZ_KJD6PMydAmq5NdTKxhlkof50Z98W0FKIXrzmI,26952
|
|
6
|
-
fastmssql/fastmssql_core.cp310-win_amd64.pyd,sha256=Zd364ZPkEwgRusMMont2b4ANksnFP3r8jKvSs0u3zGc,2820608
|
|
7
|
-
fastmssql-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|