commitdb 2.7.0__tar.gz → 2.8.0__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: commitdb
3
- Version: 2.7.0
3
+ Version: 2.8.0
4
4
  Summary: Python Client for CommitDB SQL Server
5
5
  Author: CommitDB Contributors
6
6
  License: Apache-2.0
@@ -42,7 +42,6 @@ pip install commitdb
42
42
 
43
43
  ## Quick Start
44
44
 
45
- ### Remote Mode (connect to server)
46
45
 
47
46
  ```python
48
47
  from commitdb import CommitDB
@@ -57,19 +56,6 @@ with CommitDB('localhost', 3306) as db:
57
56
  print(f"{row['id']}: {row['name']}")
58
57
  ```
59
58
 
60
- ### Embedded Mode (no server required)
61
-
62
- ```python
63
- from commitdb import CommitDBLocal
64
-
65
- with CommitDBLocal() as db: # In-memory
66
- db.execute('CREATE DATABASE mydb')
67
- db.execute('CREATE TABLE mydb.users (id INT PRIMARY KEY, name STRING)')
68
-
69
- with CommitDBLocal('/path/to/data') as db: # File-based (persistent)
70
- db.execute('CREATE DATABASE mydb')
71
- ```
72
-
73
59
  ### Ibis Mode (pandas DataFrame support)
74
60
 
75
61
  ```bash
@@ -114,20 +100,6 @@ CommitDB(host='localhost', port=3306, use_ssl=False, ssl_verify=True,
114
100
  | `query(sql)` | Execute SELECT, returns QueryResult |
115
101
  | `authenticate_jwt(token)` | Authenticate with JWT |
116
102
 
117
- ### CommitDBLocal (Embedded)
118
-
119
- ```python
120
- CommitDBLocal(path=None, lib_path=None)
121
- ```
122
-
123
- - `path` - Directory for persistence (`None` = in-memory)
124
- - `lib_path` - Path to `libcommitdb` shared library
125
-
126
- | Method | Description |
127
- |--------|-------------|
128
- | `open()` / `close()` | Open/close database |
129
- | `execute(sql)` | Execute SQL |
130
- | `query(sql)` | Execute SELECT |
131
103
 
132
104
  ### QueryResult
133
105
 
@@ -187,7 +159,7 @@ db.authenticate_jwt('eyJhbG...')
187
159
  ### Branching & Merging
188
160
 
189
161
  ```python
190
- with CommitDBLocal() as db:
162
+ with CommitDB('localhost', 3306) as db:
191
163
  db.execute('CREATE DATABASE mydb')
192
164
  db.execute('CREATE TABLE mydb.users (id INT, name STRING)')
193
165
  db.execute("INSERT INTO mydb.users VALUES (1, 'Alice')")
@@ -265,13 +237,3 @@ db.execute("""
265
237
  db.execute("COPY INTO 's3://bucket/export.csv' FROM mydb.users WITH (HEADER = TRUE)")
266
238
  ```
267
239
 
268
- ---
269
-
270
- ## Building the Shared Library
271
-
272
- For embedded mode, if the library isn't bundled:
273
-
274
- ```bash
275
- # From CommitDB root
276
- make lib # Creates lib/libcommitdb.dylib (macOS) or .so (Linux)
277
- ```
@@ -17,7 +17,6 @@ pip install commitdb
17
17
 
18
18
  ## Quick Start
19
19
 
20
- ### Remote Mode (connect to server)
21
20
 
22
21
  ```python
23
22
  from commitdb import CommitDB
@@ -32,19 +31,6 @@ with CommitDB('localhost', 3306) as db:
32
31
  print(f"{row['id']}: {row['name']}")
33
32
  ```
34
33
 
35
- ### Embedded Mode (no server required)
36
-
37
- ```python
38
- from commitdb import CommitDBLocal
39
-
40
- with CommitDBLocal() as db: # In-memory
41
- db.execute('CREATE DATABASE mydb')
42
- db.execute('CREATE TABLE mydb.users (id INT PRIMARY KEY, name STRING)')
43
-
44
- with CommitDBLocal('/path/to/data') as db: # File-based (persistent)
45
- db.execute('CREATE DATABASE mydb')
46
- ```
47
-
48
34
  ### Ibis Mode (pandas DataFrame support)
49
35
 
50
36
  ```bash
@@ -89,20 +75,6 @@ CommitDB(host='localhost', port=3306, use_ssl=False, ssl_verify=True,
89
75
  | `query(sql)` | Execute SELECT, returns QueryResult |
90
76
  | `authenticate_jwt(token)` | Authenticate with JWT |
91
77
 
92
- ### CommitDBLocal (Embedded)
93
-
94
- ```python
95
- CommitDBLocal(path=None, lib_path=None)
96
- ```
97
-
98
- - `path` - Directory for persistence (`None` = in-memory)
99
- - `lib_path` - Path to `libcommitdb` shared library
100
-
101
- | Method | Description |
102
- |--------|-------------|
103
- | `open()` / `close()` | Open/close database |
104
- | `execute(sql)` | Execute SQL |
105
- | `query(sql)` | Execute SELECT |
106
78
 
107
79
  ### QueryResult
108
80
 
@@ -162,7 +134,7 @@ db.authenticate_jwt('eyJhbG...')
162
134
  ### Branching & Merging
163
135
 
164
136
  ```python
165
- with CommitDBLocal() as db:
137
+ with CommitDB('localhost', 3306) as db:
166
138
  db.execute('CREATE DATABASE mydb')
167
139
  db.execute('CREATE TABLE mydb.users (id INT, name STRING)')
168
140
  db.execute("INSERT INTO mydb.users VALUES (1, 'Alice')")
@@ -240,13 +212,3 @@ db.execute("""
240
212
  db.execute("COPY INTO 's3://bucket/export.csv' FROM mydb.users WITH (HEADER = TRUE)")
241
213
  ```
242
214
 
243
- ---
244
-
245
- ## Building the Shared Library
246
-
247
- For embedded mode, if the library isn't bundled:
248
-
249
- ```bash
250
- # From CommitDB root
251
- make lib # Creates lib/libcommitdb.dylib (macOS) or .so (Linux)
252
- ```
@@ -22,22 +22,15 @@ Usage:
22
22
  print(row)
23
23
 
24
24
  db.close()
25
-
26
- Embedded mode (requires libcommitdb):
27
- from commitdb import CommitDBLocal
28
-
29
- with CommitDBLocal('/path/to/data') as db:
30
- db.execute('CREATE DATABASE mydb')
31
25
  """
32
26
 
33
27
  from importlib.metadata import version, PackageNotFoundError
34
28
 
35
- from .client import CommitDB, CommitDBLocal, QueryResult, CommitResult, CommitDBError
29
+ from .client import CommitDB, QueryResult, CommitResult, CommitDBError
36
30
 
37
31
  try:
38
32
  __version__ = version("commitdb")
39
33
  except PackageNotFoundError:
40
34
  __version__ = "0.0.0" # Fallback for development/editable installs
41
35
 
42
- __all__ = ['CommitDB', 'CommitDBLocal', 'QueryResult', 'CommitResult', 'CommitDBError', '__version__']
43
-
36
+ __all__ = ['CommitDB', 'QueryResult', 'CommitResult', 'CommitDBError', '__version__']
@@ -382,140 +382,3 @@ class CommitDB:
382
382
  """List all shares."""
383
383
  result = self.query('SHOW SHARES')
384
384
  return [{'name': row[0], 'url': row[1]} for row in result.data] if result.data else []
385
-
386
-
387
- class CommitDBLocal:
388
- """
389
- CommitDB embedded client using Go bindings.
390
-
391
- This mode runs the database engine directly in-process without
392
- requiring a separate server.
393
-
394
- Example:
395
- # In-memory database
396
- db = CommitDBLocal()
397
-
398
- # File-based database
399
- db = CommitDBLocal('/path/to/data')
400
-
401
- db.execute('CREATE DATABASE mydb')
402
- result = db.query('SELECT * FROM mydb.users')
403
- db.close()
404
- """
405
-
406
- def __init__(self, path: Optional[str] = None, lib_path: Optional[str] = None):
407
- """
408
- Initialize CommitDB embedded client.
409
-
410
- Args:
411
- path: Path for file-based persistence. If None, uses in-memory storage.
412
- lib_path: Optional path to libcommitdb shared library.
413
- """
414
- from .binding import CommitDBBinding
415
-
416
- self._binding = CommitDBBinding
417
- if lib_path:
418
- self._binding.load(lib_path)
419
-
420
- self._path = path
421
- self._handle: Optional[int] = None
422
-
423
- def open(self) -> 'CommitDBLocal':
424
- """Open the database."""
425
- if self._path:
426
- self._handle = self._binding.open_file(self._path)
427
- else:
428
- self._handle = self._binding.open_memory()
429
- return self
430
-
431
- def close(self) -> None:
432
- """Close the database."""
433
- if self._handle is not None:
434
- self._binding.close(self._handle)
435
- self._handle = None
436
-
437
- def __enter__(self) -> 'CommitDBLocal':
438
- return self.open()
439
-
440
- def __exit__(self, exc_type, exc_val, exc_tb) -> None:
441
- self.close()
442
-
443
- def _parse_response(self, response: dict) -> CommitResult | QueryResult:
444
- """Parse a response dict into result objects."""
445
- if not response.get('success'):
446
- raise CommitDBError(response.get('error', 'Unknown error'))
447
-
448
- result_type = response.get('type')
449
- result_data = response.get('result', {})
450
-
451
- if result_type == 'query':
452
- return QueryResult(
453
- columns=result_data.get('columns', []),
454
- data=result_data.get('data', []),
455
- records_read=result_data.get('records_read', 0),
456
- execution_time_ms=result_data.get('execution_time_ms', 0.0),
457
- execution_ops=result_data.get('execution_ops', 0)
458
- )
459
- elif result_type == 'commit':
460
- return CommitResult(
461
- databases_created=result_data.get('databases_created', 0),
462
- databases_deleted=result_data.get('databases_deleted', 0),
463
- tables_created=result_data.get('tables_created', 0),
464
- tables_deleted=result_data.get('tables_deleted', 0),
465
- records_written=result_data.get('records_written', 0),
466
- records_deleted=result_data.get('records_deleted', 0),
467
- execution_time_ms=result_data.get('execution_time_ms', 0.0),
468
- execution_ops=result_data.get('execution_ops', 0)
469
- )
470
- else:
471
- return CommitResult()
472
-
473
- def execute(self, query: str) -> CommitResult | QueryResult:
474
- """
475
- Execute a SQL query.
476
-
477
- Args:
478
- query: SQL query to execute
479
-
480
- Returns:
481
- QueryResult for SELECT queries, CommitResult for mutations
482
- """
483
- if self._handle is None:
484
- raise CommitDBError("Database not open. Call open() first.")
485
-
486
- response = self._binding.execute(self._handle, query)
487
- return self._parse_response(response)
488
-
489
- def query(self, sql: str) -> QueryResult:
490
- """Execute a SELECT query and return results."""
491
- result = self.execute(sql)
492
- if not isinstance(result, QueryResult):
493
- raise CommitDBError("Expected query result, got commit result")
494
- return result
495
-
496
- def create_database(self, name: str) -> CommitResult:
497
- """Create a database."""
498
- result = self.execute(f'CREATE DATABASE {name}')
499
- if not isinstance(result, CommitResult):
500
- raise CommitDBError("Expected commit result")
501
- return result
502
-
503
- def create_table(self, database: str, table: str, columns: str) -> CommitResult:
504
- """Create a table."""
505
- result = self.execute(f'CREATE TABLE {database}.{table} ({columns})')
506
- if not isinstance(result, CommitResult):
507
- raise CommitDBError("Expected commit result")
508
- return result
509
-
510
- def insert(self, database: str, table: str, columns: list[str], values: list) -> CommitResult:
511
- """Insert a row."""
512
- cols = ', '.join(columns)
513
- vals = ', '.join(
514
- f"'{v}'" if isinstance(v, str) else str(v)
515
- for v in values
516
- )
517
- result = self.execute(f'INSERT INTO {database}.{table} ({cols}) VALUES ({vals})')
518
- if not isinstance(result, CommitResult):
519
- raise CommitDBError("Expected commit result")
520
- return result
521
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commitdb
3
- Version: 2.7.0
3
+ Version: 2.8.0
4
4
  Summary: Python Client for CommitDB SQL Server
5
5
  Author: CommitDB Contributors
6
6
  License: Apache-2.0
@@ -42,7 +42,6 @@ pip install commitdb
42
42
 
43
43
  ## Quick Start
44
44
 
45
- ### Remote Mode (connect to server)
46
45
 
47
46
  ```python
48
47
  from commitdb import CommitDB
@@ -57,19 +56,6 @@ with CommitDB('localhost', 3306) as db:
57
56
  print(f"{row['id']}: {row['name']}")
58
57
  ```
59
58
 
60
- ### Embedded Mode (no server required)
61
-
62
- ```python
63
- from commitdb import CommitDBLocal
64
-
65
- with CommitDBLocal() as db: # In-memory
66
- db.execute('CREATE DATABASE mydb')
67
- db.execute('CREATE TABLE mydb.users (id INT PRIMARY KEY, name STRING)')
68
-
69
- with CommitDBLocal('/path/to/data') as db: # File-based (persistent)
70
- db.execute('CREATE DATABASE mydb')
71
- ```
72
-
73
59
  ### Ibis Mode (pandas DataFrame support)
74
60
 
75
61
  ```bash
@@ -114,20 +100,6 @@ CommitDB(host='localhost', port=3306, use_ssl=False, ssl_verify=True,
114
100
  | `query(sql)` | Execute SELECT, returns QueryResult |
115
101
  | `authenticate_jwt(token)` | Authenticate with JWT |
116
102
 
117
- ### CommitDBLocal (Embedded)
118
-
119
- ```python
120
- CommitDBLocal(path=None, lib_path=None)
121
- ```
122
-
123
- - `path` - Directory for persistence (`None` = in-memory)
124
- - `lib_path` - Path to `libcommitdb` shared library
125
-
126
- | Method | Description |
127
- |--------|-------------|
128
- | `open()` / `close()` | Open/close database |
129
- | `execute(sql)` | Execute SQL |
130
- | `query(sql)` | Execute SELECT |
131
103
 
132
104
  ### QueryResult
133
105
 
@@ -187,7 +159,7 @@ db.authenticate_jwt('eyJhbG...')
187
159
  ### Branching & Merging
188
160
 
189
161
  ```python
190
- with CommitDBLocal() as db:
162
+ with CommitDB('localhost', 3306) as db:
191
163
  db.execute('CREATE DATABASE mydb')
192
164
  db.execute('CREATE TABLE mydb.users (id INT, name STRING)')
193
165
  db.execute("INSERT INTO mydb.users VALUES (1, 'Alice')")
@@ -265,13 +237,3 @@ db.execute("""
265
237
  db.execute("COPY INTO 's3://bucket/export.csv' FROM mydb.users WITH (HEADER = TRUE)")
266
238
  ```
267
239
 
268
- ---
269
-
270
- ## Building the Shared Library
271
-
272
- For embedded mode, if the library isn't bundled:
273
-
274
- ```bash
275
- # From CommitDB root
276
- make lib # Creates lib/libcommitdb.dylib (macOS) or .so (Linux)
277
- ```
@@ -1,7 +1,6 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  commitdb/__init__.py
4
- commitdb/binding.py
5
4
  commitdb/client.py
6
5
  commitdb/ibis_backend.py
7
6
  commitdb.egg-info/PKG-INFO
@@ -10,7 +9,6 @@ commitdb.egg-info/dependency_links.txt
10
9
  commitdb.egg-info/entry_points.txt
11
10
  commitdb.egg-info/requires.txt
12
11
  commitdb.egg-info/top_level.txt
13
- commitdb/lib/libcommitdb-linux-amd64.so
14
12
  tests/__init__.py
15
13
  tests/test_client.py
16
14
  tests/test_ibis.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "commitdb"
7
- version = "2.7.0"
7
+ version = "2.8.0"
8
8
  description = "Python Client for CommitDB SQL Server"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -31,9 +31,6 @@ Repository = "https://github.com/nickyhof/CommitDB"
31
31
  [tool.setuptools.packages.find]
32
32
  where = ["."]
33
33
 
34
- [tool.setuptools.package-data]
35
- commitdb = ["lib/*.so", "lib/*.dylib", "lib/*.dll"]
36
-
37
34
  [project.optional-dependencies]
38
35
  dev = ["pytest>=7.0"]
39
36
  ibis = ["ibis-framework>=11.0", "pandas>=2.0"]