fastmssql 0.2.7__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 0.2.8__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.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/__init__.py +0 -85
- fastmssql/fastmssql.cpython-312-aarch64-linux-gnu.so +0 -0
- {fastmssql-0.2.7.dist-info → fastmssql-0.2.8.dist-info}/METADATA +1 -1
- fastmssql-0.2.8.dist-info/RECORD +6 -0
- fastmssql-0.2.7.dist-info/RECORD +0 -6
- {fastmssql-0.2.7.dist-info → fastmssql-0.2.8.dist-info}/WHEEL +0 -0
- {fastmssql-0.2.7.dist-info → fastmssql-0.2.8.dist-info}/licenses/LICENSE +0 -0
fastmssql/__init__.py
CHANGED
|
@@ -332,91 +332,6 @@ class Connection:
|
|
|
332
332
|
# The Rust implementation now returns results directly
|
|
333
333
|
return await self._conn.execute(query, parameters)
|
|
334
334
|
|
|
335
|
-
def execute_with_python_params(self, query, params):
|
|
336
|
-
"""
|
|
337
|
-
Execute a SQL query synchronously with Python-style parameter substitution.
|
|
338
|
-
|
|
339
|
-
This method provides a synchronous interface for executing SQL queries with
|
|
340
|
-
parameter substitution using Python's DB-API 2.0 style placeholders (?).
|
|
341
|
-
It's designed for compatibility with existing Python database code and
|
|
342
|
-
simple synchronous operations.
|
|
343
|
-
|
|
344
|
-
Parameter Binding:
|
|
345
|
-
Uses question mark (?) placeholders in the query string, with parameters
|
|
346
|
-
provided as a list in the same order as the placeholders appear.
|
|
347
|
-
|
|
348
|
-
Note:
|
|
349
|
-
This is a synchronous method that blocks until the query completes.
|
|
350
|
-
For better performance in async applications, prefer the async execute() method.
|
|
351
|
-
|
|
352
|
-
Args:
|
|
353
|
-
query (str): SQL query with ? placeholders for parameters.
|
|
354
|
-
Example: "SELECT * FROM users WHERE age > ? AND city = ?"
|
|
355
|
-
|
|
356
|
-
params (list): List of parameter values in order of appearance.
|
|
357
|
-
Values are automatically converted to appropriate SQL types.
|
|
358
|
-
Example: [18, "New York"]
|
|
359
|
-
|
|
360
|
-
Returns:
|
|
361
|
-
list: A list of dictionaries representing the result rows.
|
|
362
|
-
Each dictionary maps column names to values.
|
|
363
|
-
For non-SELECT queries, returns an empty list.
|
|
364
|
-
|
|
365
|
-
Raises:
|
|
366
|
-
SqlError: If the SQL query contains syntax errors or constraint violations.
|
|
367
|
-
ConnectionError: If the database connection is not available.
|
|
368
|
-
ParameterError: If parameter types cannot be converted or are invalid.
|
|
369
|
-
|
|
370
|
-
Examples:
|
|
371
|
-
# Simple SELECT query
|
|
372
|
-
>>> rows = conn.execute_with_python_params(
|
|
373
|
-
... "SELECT id, name, email FROM users WHERE active = ?",
|
|
374
|
-
... [True]
|
|
375
|
-
... )
|
|
376
|
-
>>> for row in rows:
|
|
377
|
-
... print(f"User: {row['name']} ({row['email']})")
|
|
378
|
-
|
|
379
|
-
# INSERT operation
|
|
380
|
-
>>> conn.execute_with_python_params(
|
|
381
|
-
... "INSERT INTO logs (message, level, timestamp) VALUES (?, ?, ?)",
|
|
382
|
-
... ["Application started", "INFO", datetime.now()]
|
|
383
|
-
... )
|
|
384
|
-
|
|
385
|
-
# UPDATE with multiple parameters
|
|
386
|
-
>>> conn.execute_with_python_params(
|
|
387
|
-
... "UPDATE users SET last_login = ?, login_count = login_count + 1 WHERE id = ?",
|
|
388
|
-
... [datetime.now(), 12345]
|
|
389
|
-
... )
|
|
390
|
-
|
|
391
|
-
# Complex query with various data types
|
|
392
|
-
>>> from decimal import Decimal
|
|
393
|
-
>>> rows = conn.execute_with_python_params(
|
|
394
|
-
... \"\"\"SELECT p.name, p.price, c.name as category
|
|
395
|
-
... FROM products p
|
|
396
|
-
... JOIN categories c ON p.category_id = c.id
|
|
397
|
-
... WHERE p.price BETWEEN ? AND ? AND p.discontinued = ?\"\"\",
|
|
398
|
-
... [Decimal('10.00'), Decimal('100.00'), False]
|
|
399
|
-
... )
|
|
400
|
-
|
|
401
|
-
Migration from DB-API 2.0:
|
|
402
|
-
This method is designed to be compatible with Python's DB-API 2.0
|
|
403
|
-
specification, making it easier to migrate from libraries like pyodbc
|
|
404
|
-
or pymssql with minimal code changes.
|
|
405
|
-
|
|
406
|
-
# Old pyodbc code:
|
|
407
|
-
# cursor.execute("SELECT * FROM users WHERE id = ?", [user_id])
|
|
408
|
-
# rows = cursor.fetchall()
|
|
409
|
-
|
|
410
|
-
# New fastmssql code:
|
|
411
|
-
# rows = conn.execute_with_python_params("SELECT * FROM users WHERE id = ?", [user_id])
|
|
412
|
-
|
|
413
|
-
Performance Considerations:
|
|
414
|
-
- This method is synchronous and will block the calling thread
|
|
415
|
-
- For high-throughput applications, use the async execute() method instead
|
|
416
|
-
- Connection pooling is still utilized for efficient resource management
|
|
417
|
-
- Results are loaded entirely into memory, so be cautious with large result sets
|
|
418
|
-
"""
|
|
419
|
-
return self._conn.execute_with_python_params(query, params)
|
|
420
335
|
|
|
421
336
|
async def is_connected(self):
|
|
422
337
|
"""
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
fastmssql-0.2.8.dist-info/METADATA,sha256=pbN2t4Cuhy1rzvxweu537UUq6vrP42RZNmoOyg_Y94o,24664
|
|
2
|
+
fastmssql-0.2.8.dist-info/RECORD,,
|
|
3
|
+
fastmssql-0.2.8.dist-info/WHEEL,sha256=fWSNDXR4QbTmMc5N5UF9gb1bNDKerx5Y777rNvXm14s,149
|
|
4
|
+
fastmssql-0.2.8.dist-info/licenses/LICENSE,sha256=NwufX3BNj7RvVtnrshWhkpFOLvWc_YVpGpr3UZGFz_E,4765
|
|
5
|
+
fastmssql/fastmssql.cpython-312-aarch64-linux-gnu.so,sha256=uou78O7tN7O6B6SZZ7ziJTKMJ11hYZx5cUfjISHgUn0,2182912
|
|
6
|
+
fastmssql/__init__.py,sha256=5D3MpxBm8I33nKOml8wlHJbfH1-9bak68md3xj1Rds0,24923
|
fastmssql-0.2.7.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
fastmssql-0.2.7.dist-info/METADATA,sha256=pF7dtgu6k6kSZfz-_kLln9dlcjYgWi5yKzbu-L02TU0,24664
|
|
2
|
-
fastmssql-0.2.7.dist-info/RECORD,,
|
|
3
|
-
fastmssql-0.2.7.dist-info/WHEEL,sha256=fWSNDXR4QbTmMc5N5UF9gb1bNDKerx5Y777rNvXm14s,149
|
|
4
|
-
fastmssql-0.2.7.dist-info/licenses/LICENSE,sha256=NwufX3BNj7RvVtnrshWhkpFOLvWc_YVpGpr3UZGFz_E,4765
|
|
5
|
-
fastmssql/fastmssql.cpython-312-aarch64-linux-gnu.so,sha256=FuEw0zwC9oou51kWJgoPwByiOAFevF6ZxGyKDcaKoeg,4458680
|
|
6
|
-
fastmssql/__init__.py,sha256=1DZiNk-l6MFhxGVWikdxDQiaXh_6FyhQWtz6UxyxO9s,29041
|
|
File without changes
|
|
File without changes
|