s3rds 0.3.0__tar.gz → 0.3.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: s3rds
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: A truly serverless RDS on your own AWS account: Lambda URL endpoint, SQLite on S3, ≈ $0 when idle. Drivers named after the standard clients: s3rds.sqlite, s3rds.pymysql, s3rds.psycopg2; SQLAlchemy via sqlite+s3rds://, Django via ENGINE s3rds.sqlite.
5
5
  Author: Frank Zhang
6
6
  License: MIT
@@ -24,6 +24,8 @@ Requires-Python: >=3.9
24
24
  Description-Content-Type: text/markdown
25
25
  Requires-Dist: sqlglot<31,>=30.24
26
26
  Provides-Extra: mysql
27
+ Provides-Extra: server
28
+ Requires-Dist: sqlean.py==3.50.4.5; extra == "server"
27
29
  Provides-Extra: sqlalchemy
28
30
  Requires-Dist: SQLAlchemy<2.1,>=2.0; extra == "sqlalchemy"
29
31
  Provides-Extra: django
@@ -45,23 +47,23 @@ Requires-Dist: Django<6.2,>=6.1; extra == "django"
45
47
 
46
48
  Everything else stays: models, queries, cursors, transactions. For all of them: one writer at a time, every commit
47
49
  uploads the whole file (a few hundred ms), so keep a database under ~20 MB. Moving to RDS later is the same change
48
- backwards (`import pymysql`, `mysql+pymysql://`, `django.db.backends.mysql`). Refused features raise
50
+ backwards (`import pymysql`, `import psycopg2`, `mysql+pymysql://`, `django.db.backends.mysql`). Refused features raise
49
51
  `NotSupportedError` — never silently different.
50
52
 
51
53
  ### The server: deploy once, ≈ $0 when idle
52
54
 
53
55
  You need an s3rds server in your own AWS account — a Lambda Function URL and an S3 bucket, nothing running
54
- while nobody uses it. Deploy it once with Terraform or CloudFormation from the
56
+ while nobody uses it. Deploy it once with Terraform from the
55
57
  [main repository](https://github.com/cloudformer/s3rds#quick-start). Same as any driver needs its database.
56
58
 
57
59
  **Python drivers for [s3rds](https://github.com/cloudformer/s3rds) — a truly serverless RDS:
58
60
  a Lambda URL as your database endpoint, SQLite on S3, ≈ $0 when idle.**
59
61
 
60
- One install, one dependency (sqlglot, used only by `s3rds.pymysql`). Each driver is a submodule **named after the standard
62
+ One install, one dependency (sqlglot, used only by `s3rds.pymysql` and `s3rds.psycopg2`). Each driver is a submodule **named after the standard
61
63
  client it mirrors**, so moving to a real database is a one-line import change and nothing else:
62
64
 
63
65
  ```bash
64
- pip install s3rds # s3rds.sqlite, s3rds.pymysql, sqlite+s3rds:// for SQLAlchemy, ENGINE s3rds.sqlite for Django
66
+ pip install s3rds # s3rds.sqlite, s3rds.pymysql, s3rds.psycopg2, sqlite+s3rds:// for SQLAlchemy, ENGINE s3rds.sqlite for Django
65
67
  ```
66
68
 
67
69
  ```python
@@ -134,6 +136,7 @@ conversion in queries (keep `TIME_ZONE` equal to the connection's), `__regex`, `
134
136
  server (stale keep-alive connection). Timeouts raise an error with an explicit "result unknown".
135
137
  - `s3rds.pymysql` raises pymysql-style exceptions with MySQL error codes (1062, 1146, 1054, 1064, …);
136
138
  unsupported MySQL features raise `NotSupportedError` instead of misbehaving silently.
139
+ - `s3rds.psycopg2` raises psycopg2's classes (`s3rds.psycopg2.errors.UniqueViolation`, …) with the SQLSTATE in `pgcode`.
137
140
 
138
141
  ## Versions
139
142
 
@@ -143,7 +146,7 @@ What the report was verified with; the full report: [REPORT.md](https://github.c
143
146
  |---|---|---|
144
147
  | Python (client) | 3.9 – 3.13: regression suite on 3.9.6, full comparison on 3.13.7 | `requires-python = ">=3.9"` |
145
148
  | Server runtime | AWS Lambda `python3.12` | `terraform/main.tf` |
146
- | SQLite (server engine) | 3.50.4, shipped in the Lambda zip (the runtime's own is 3.40.0) | `src/db/requirements.txt`: `sqlean.py==3.50.4.5` |
149
+ | SQLite (server engine) | 3.50.4, shipped in the Lambda zip (the runtime's own is 3.40.0) | extra `pip install "s3rds[server]"` = `sqlean.py==3.50.4.5` |
147
150
  | sqlglot (MySQL translation) | 30.24 | dependency `sqlglot>=30.24,<31` |
148
151
  | SQLAlchemy | 2.0, tested on 2.0.55 | extra `pip install "s3rds[sqlalchemy]"` = `SQLAlchemy>=2.0,<2.1` |
149
152
  | Django | 6.1, tested on 6.1.2 (Python ≥ 3.12) | extra `pip install "s3rds[django]"` = `Django>=6.1,<6.2` |
@@ -14,23 +14,23 @@
14
14
 
15
15
  Everything else stays: models, queries, cursors, transactions. For all of them: one writer at a time, every commit
16
16
  uploads the whole file (a few hundred ms), so keep a database under ~20 MB. Moving to RDS later is the same change
17
- backwards (`import pymysql`, `mysql+pymysql://`, `django.db.backends.mysql`). Refused features raise
17
+ backwards (`import pymysql`, `import psycopg2`, `mysql+pymysql://`, `django.db.backends.mysql`). Refused features raise
18
18
  `NotSupportedError` — never silently different.
19
19
 
20
20
  ### The server: deploy once, ≈ $0 when idle
21
21
 
22
22
  You need an s3rds server in your own AWS account — a Lambda Function URL and an S3 bucket, nothing running
23
- while nobody uses it. Deploy it once with Terraform or CloudFormation from the
23
+ while nobody uses it. Deploy it once with Terraform from the
24
24
  [main repository](https://github.com/cloudformer/s3rds#quick-start). Same as any driver needs its database.
25
25
 
26
26
  **Python drivers for [s3rds](https://github.com/cloudformer/s3rds) — a truly serverless RDS:
27
27
  a Lambda URL as your database endpoint, SQLite on S3, ≈ $0 when idle.**
28
28
 
29
- One install, one dependency (sqlglot, used only by `s3rds.pymysql`). Each driver is a submodule **named after the standard
29
+ One install, one dependency (sqlglot, used only by `s3rds.pymysql` and `s3rds.psycopg2`). Each driver is a submodule **named after the standard
30
30
  client it mirrors**, so moving to a real database is a one-line import change and nothing else:
31
31
 
32
32
  ```bash
33
- pip install s3rds # s3rds.sqlite, s3rds.pymysql, sqlite+s3rds:// for SQLAlchemy, ENGINE s3rds.sqlite for Django
33
+ pip install s3rds # s3rds.sqlite, s3rds.pymysql, s3rds.psycopg2, sqlite+s3rds:// for SQLAlchemy, ENGINE s3rds.sqlite for Django
34
34
  ```
35
35
 
36
36
  ```python
@@ -103,6 +103,7 @@ conversion in queries (keep `TIME_ZONE` equal to the connection's), `__regex`, `
103
103
  server (stale keep-alive connection). Timeouts raise an error with an explicit "result unknown".
104
104
  - `s3rds.pymysql` raises pymysql-style exceptions with MySQL error codes (1062, 1146, 1054, 1064, …);
105
105
  unsupported MySQL features raise `NotSupportedError` instead of misbehaving silently.
106
+ - `s3rds.psycopg2` raises psycopg2's classes (`s3rds.psycopg2.errors.UniqueViolation`, …) with the SQLSTATE in `pgcode`.
106
107
 
107
108
  ## Versions
108
109
 
@@ -112,7 +113,7 @@ What the report was verified with; the full report: [REPORT.md](https://github.c
112
113
  |---|---|---|
113
114
  | Python (client) | 3.9 – 3.13: regression suite on 3.9.6, full comparison on 3.13.7 | `requires-python = ">=3.9"` |
114
115
  | Server runtime | AWS Lambda `python3.12` | `terraform/main.tf` |
115
- | SQLite (server engine) | 3.50.4, shipped in the Lambda zip (the runtime's own is 3.40.0) | `src/db/requirements.txt`: `sqlean.py==3.50.4.5` |
116
+ | SQLite (server engine) | 3.50.4, shipped in the Lambda zip (the runtime's own is 3.40.0) | extra `pip install "s3rds[server]"` = `sqlean.py==3.50.4.5` |
116
117
  | sqlglot (MySQL translation) | 30.24 | dependency `sqlglot>=30.24,<31` |
117
118
  | SQLAlchemy | 2.0, tested on 2.0.55 | extra `pip install "s3rds[sqlalchemy]"` = `SQLAlchemy>=2.0,<2.1` |
118
119
  | Django | 6.1, tested on 6.1.2 (Python ≥ 3.12) | extra `pip install "s3rds[django]"` = `Django>=6.1,<6.2` |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "s3rds"
7
- version = "0.3.0"
7
+ version = "0.3.2"
8
8
  description = "A truly serverless RDS on your own AWS account: Lambda URL endpoint, SQLite on S3, ≈ $0 when idle. Drivers named after the standard clients: s3rds.sqlite, s3rds.pymysql, s3rds.psycopg2; SQLAlchemy via sqlite+s3rds://, Django via ENGINE s3rds.sqlite."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -29,6 +29,7 @@ dependencies = ["sqlglot>=30.24,<31"]
29
29
 
30
30
  [project.optional-dependencies]
31
31
  mysql = [] # kept so that pip install "s3rds[mysql]" from 0.1.x keeps working
32
+ server = ["sqlean.py==3.50.4.5"] # the Lambda: s3rds.server + SQLite 3.50.4 instead of the runtime's 3.40.0
32
33
  sqlalchemy = ["SQLAlchemy>=2.0,<2.1"] # the series the compatibility report verified; pip install "s3rds[sqlalchemy]"
33
34
  django = ["Django>=6.1,<6.2"] # the same for Django (ENGINE "s3rds.sqlite"); Django 6.1 needs Python >= 3.12
34
35
 
@@ -44,14 +45,17 @@ Changelog = "https://github.com/cloudformer/s3rds/blob/main/CHANGELOG.md"
44
45
  Issues = "https://github.com/cloudformer/s3rds/issues"
45
46
 
46
47
  [tool.setuptools]
47
- packages = ["s3rds", "s3rds.sqlite", "s3rds.psycopg2"]
48
+ packages = ["s3rds", "s3rds.sqlite", "s3rds.psycopg2", "s3rds.server"]
49
+
50
+ [tool.setuptools.package-data]
51
+ "s3rds.server" = ["index.html"]
48
52
 
49
53
  # The versions tests/compat/REPORT.md was verified with; README.md, README.zh.md and client/README.md state the same.
50
54
  [tool.s3rds.verified]
51
55
  python = ["3.9.6", "3.13.7"] # the client: regression suite on 3.9.6, the full comparison on 3.13.7
52
56
  lambda_runtime = "python3.12" # the server (terraform/main.tf)
53
57
  sqlite = "3.50.4" # the server's engine, shipped in the Lambda zip (the runtime's own is 3.40.0)
54
- sqlean = "3.50.4.5" # sqlean.py, which carries it (src/db/requirements.txt)
58
+ sqlean = "3.50.4.5" # sqlean.py, which carries it (extra "server")
55
59
  sqlglot = "30.24.0"
56
60
  sqlalchemy = "2.0.55"
57
61
  django = "6.1.2"
@@ -0,0 +1,5 @@
1
+ """s3rds server: the Lambda behind the endpoint. pip install "s3rds[server]" (adds the pinned SQLite engine).
2
+
3
+ Lambda handler: s3rds.server.lambda_function.lambda_handler. Not imported here: lambda_function reads its
4
+ environment (DB_BUCKET, ...) at import time, and a client never needs it.
5
+ """