@@ -23,20 +23,17 @@ with Client(username="your_username", password="your_password") as client:
2323
2424 # Process results
2525 for batch in reader:
26- df = batch.to_pandas()
26+ df = batch.data. to_pandas()
2727 print (df)
2828```
2929
30- ### Custom Connection
30+ ### Connect to specific catalog/schema
3131
3232``` python
3333# Connect to custom host/port
3434client = Client(
3535 username = " admin" ,
3636 password = " secret" ,
37- host = " localhost" ,
38- port = 15002 ,
39- tls = False ,
4037 catalog = " my_catalog" ,
4138 schema = " my_schema"
4239)
@@ -48,7 +45,7 @@ client = Client(
4845# Execute SELECT query
4946reader = client.query(" SELECT * FROM users" )
5047for batch in reader:
51- print (batch.to_pandas())
48+ print (batch.data. to_pandas())
5249
5350# Execute INSERT/UPDATE/DELETE
5451rows_affected = client.execute(" INSERT INTO users (name) VALUES ('Alice')" )
@@ -59,24 +56,18 @@ print(f"Affected {rows_affected} rows")
5956
6057``` python
6158# Prepare once, execute multiple times
62- with client.prepare(" SELECT * FROM users WHERE id = ? " ) as stmt:
63- result = stmt.query()
59+ with client.prepare(" SELECT * FROM users WHERE id = $id " ) as stmt:
60+ result = stmt.query(parameters = { " id " : 1 }) )
6461 for batch in result:
65- print (batch.to_pandas())
62+ print (batch.data. to_pandas())
6663```
6764
6865### Transactions
6966
7067``` python
71- # Begin transaction
72- txn_id = client.begin_transaction()
73-
74- try :
75- client.execute(" INSERT INTO users ..." , transaction_id = txn_id)
76- client.execute(" UPDATE accounts ..." , transaction_id = txn_id)
77- client.commit_transaction(txn_id)
78- except Exception :
79- client.rollback_transaction(txn_id)
68+ with client.begin_transaction():
69+ client.execute(" INSERT INTO users ..." )
70+ client.execute(" UPDATE accounts ..." )
8071```
8172
8273### Metadata Queries
@@ -86,29 +77,16 @@ except Exception:
8677catalogs = client.get_catalogs()
8778schemas = client.get_schemas(catalog = " my_db" )
8879tables = client.get_tables(catalog = " my_db" , schema_pattern = " public" )
89-
90- # Get primary keys
91- pkeys = client.get_primary_keys(" users" , catalog = " my_db" , schema = " public" )
9280```
9381
94- ## Features
95-
96- - 🚀 High-level Python client for Altertable
97- - 🔌 Built on Apache Arrow Flight SQL
98- - 🐍 Clean, Pythonic API with type hints
99- - 📦 Simple installation with no build dependencies
100- - 🔒 Secure authentication and transaction support
101- - 📊 Easy result handling (Arrow, Pandas integration)
102- - 🔧 Prepared statements and batch operations
103-
10482## Development
10583
10684### Setup
10785
10886``` bash
10987# Clone repository
110- git clone https://github.com/yourusername /altertable-flightsql.git
111- cd altertable-flightsql
88+ git clone https://github.com/altertable-ai /altertable-flightsql-python .git
89+ cd altertable-flightsql-python
11290
11391# Install with dev dependencies
11492pip install -e " .[dev]"
@@ -143,9 +121,6 @@ See the `examples/` directory for complete examples:
143121``` bash
144122# High-level client examples
145123python examples/client_usage.py
146-
147- # Low-level protocol examples (advanced)
148- python examples/basic_usage.py
149124```
150125
151126## Testing
0 commit comments