You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readmes/sqlspec.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
8
8
SQLSpec is a SQL execution layer for Python. You write the SQL -- as strings, through a builder API, or loaded from files -- and SQLSpec handles connections, parameter binding, SQL injection prevention, dialect translation, and mapping results back to typed Python objects. It uses [sqlglot](https://github.com/tobymao/sqlglot) under the hood to parse, validate, and optimize your queries before they hit the database.
9
9
10
-
It works with PostgreSQL (asyncpg, psycopg, psqlpy), SQLite (sqlite3, aiosqlite), DuckDB, MySQL (asyncmy, mysql-connector, pymysql), Oracle (oracledb), CockroachDB, BigQuery, Spanner, and anything ADBC-compatible. Sync or async, same API. It also includes a built-in storage layer, native and bridged Arrow support for all drivers, and integrations for Litestar, FastAPI, Flask, Sanic, and Starlette.
10
+
It works with PostgreSQL (asyncpg, psycopg, psqlpy), SQLite (sqlite3, aiosqlite), DuckDB, MySQL (asyncmy, aiomysql, mysql-connector, pymysql), SQL Server (mssql-python, pymssql, arrow-odbc), Oracle (oracledb), CockroachDB, BigQuery, Spanner, and supported ADBC backends including Snowflake, Flight SQL, and GizmoSQL. Sync or async, same API. It also includes a built-in storage layer, Arrow export through native paths or conversion fallbacks, storage-bridge bulk ingest for adapters with native ingest support, and integrations for Litestar, FastAPI, Flask, Sanic, and Starlette.
11
11
12
12
## Quick Start
13
13
@@ -16,11 +16,13 @@ pip install sqlspec
16
16
```
17
17
18
18
```python
19
-
from pydantic import BaseModel
19
+
from dataclasses import dataclass
20
+
20
21
from sqlspec import SQLSpec
21
22
from sqlspec.adapters.sqlite import SqliteConfig
22
23
23
-
classGreeting(BaseModel):
24
+
@dataclass
25
+
classGreeting:
24
26
message: str
25
27
26
28
spec = SQLSpec()
@@ -46,21 +48,22 @@ users = session.select(
46
48
.where("active = :active")
47
49
.order_by("name")
48
50
.limit(10),
49
-
{"active": True},
51
+
active=True,
50
52
schema_type=User,
51
53
)
52
54
```
53
55
54
56
## Features
55
57
56
-
-**Connection pooling** -- sync and async adapters with a unified API across all supported drivers
58
+
-**Session lifecycle** -- sync and async sessions with pooling where the adapter supports it
57
59
-**Parameter binding and dialect translation** -- powered by sqlglot, with a fluent query builder and `.sql` file loader
58
60
-**Result mapping** -- map rows to Pydantic, msgspec, attrs, or dataclass models, or export to Arrow tables for pandas and Polars
59
61
-**Storage layer** -- read and write Arrow tables to local files, fsspec, or object stores
0 commit comments