s3rds 0.3.2__tar.gz → 0.3.3__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.2
3
+ Version: 0.3.3
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "s3rds"
7
- version = "0.3.2"
7
+ version = "0.3.3"
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"
@@ -191,9 +191,9 @@ dialog .form-grid { grid-template-columns: 1fr; }
191
191
 
192
192
  <div class="controls">
193
193
  <label>Database</label><select id="dbs"></select>
194
- <button class="btn btn-secondary" id="newdb">+ New database</button>
194
+ <button class="btn btn-secondary" id="newdb">+ New database</button>
195
195
  <label>Table</label><select id="tables"></select>
196
- <button class="btn btn-secondary" id="newtable">+ New table</button>
196
+ <button class="btn btn-secondary" id="newtable">+ New table</button>
197
197
  <button class="btn btn-ghost" id="refresh">refresh</button>
198
198
  </div>
199
199
 
@@ -397,13 +397,13 @@ function render(){
397
397
  $('#info-db').textContent = state.db || '-';
398
398
  const main = $('#main');
399
399
  if (!state.db){
400
- main.innerHTML = '<div class="table-section"><div class="empty">Pick a database above, or click “+ New database”</div></div>';
400
+ main.innerHTML = '<div class="table-section"><div class="empty">Pick a database above, or click “+ New database”</div></div>';
401
401
  return;
402
402
  }
403
403
  if (!state.table){
404
404
  main.innerHTML = `<div class="table-section"><div class="empty">${state.tables.length
405
405
  ? 'Pick a table above'
406
- : 'No tables yet — click “+ New table”, or write CREATE TABLE in the SQL box'}</div></div>`;
406
+ : 'No tables yet — click “+ New table”, or write CREATE TABLE in the SQL box'}</div></div>`;
407
407
  return;
408
408
  }
409
409
  if (!state.loaded){
@@ -461,7 +461,7 @@ function render(){
461
461
  </div>
462
462
 
463
463
  <div class="section-title">Structure
464
- <button class="btn btn-secondary btn-small" id="addcol">+ Add column</button>
464
+ <button class="btn btn-secondary btn-small" id="addcol">+ Add column</button>
465
465
  </div>
466
466
  <div class="grid-wrap"><table>
467
467
  <thead><tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th><th>Extra</th><th>actions</th></tr></thead>
@@ -594,7 +594,7 @@ $('#newtable').onclick = async () => {
594
594
  try {
595
595
  await api(`/api/db/${state.db}/query`, {method:'POST', body: JSON.stringify(
596
596
  {sql: `CREATE TABLE "${name}" (id INTEGER PRIMARY KEY AUTOINCREMENT) STRICT`})});
597
- msg(`✓ created table ${name} (STRICT, with an autoincrement id); add fields with “+ Add column”`, true);
597
+ msg(`✓ created table ${name} (STRICT, with an autoincrement id); add fields with “+ Add column”`, true);
598
598
  await loadTables(name);
599
599
  await loadRows(); // open the table just created
600
600
  } catch(e){ msg(friendly(e.message)); }
@@ -1,6 +1,6 @@
1
1
  """s3rds server: a serverless database (SQL over HTTP, SQLite on S3).
2
2
 
3
- GET / index.html (web console)
3
+ GET / index.html (web console; CONSOLE=0 -> 404, API only)
4
4
  GET /api/databases list databases
5
5
  POST /api/databases {name} create a database
6
6
  GET /api/db/{db}/tables list tables
@@ -35,6 +35,7 @@ PREFIX = os.environ.get("DB_PREFIX", "")
35
35
  DB_USER = os.environ.get("DB_USER", "")
36
36
  DB_PASSWORD = os.environ.get("DB_PASSWORD", "")
37
37
  READONLY = os.environ.get("READONLY") == "1"
38
+ CONSOLE = os.environ.get("CONSOLE", "1") == "1" # the web console at GET /; unset = on
38
39
 
39
40
  with open(os.path.join(os.path.dirname(__file__), "index.html"), encoding="utf-8") as f:
40
41
  INDEX_HTML = f.read()
@@ -379,6 +380,8 @@ def lambda_handler(event, context):
379
380
  path = event.get("rawPath", "/")
380
381
 
381
382
  if method == "GET" and path in ("/", "/index.html"):
383
+ if not CONSOLE:
384
+ return _json(404, {"error": "the web console is turned off (console = false); the API is under /api/"})
382
385
  return {
383
386
  "statusCode": 200,
384
387
  "headers": {"content-type": "text/html; charset=utf-8"},
@@ -49,7 +49,7 @@ import socket
49
49
  import urllib.parse
50
50
  import warnings
51
51
 
52
- __version__ = "0.3.2"
52
+ __version__ = "0.3.3"
53
53
 
54
54
  apilevel = "2.0"
55
55
  threadsafety = 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: s3rds
3
- Version: 0.3.2
3
+ Version: 0.3.3
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes