matrixone-python-sdk 0.1.0__tar.gz → 0.1.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.
Files changed (73) hide show
  1. {matrixone_python_sdk-0.1.0/matrixone_python_sdk.egg-info → matrixone_python_sdk-0.1.2}/PKG-INFO +17 -1
  2. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/README.md +16 -0
  3. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/README_USER.md +16 -0
  4. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_01_basic_connection.py +11 -11
  5. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_02_account_management.py +8 -4
  6. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_03_async_operations.py +5 -5
  7. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_04_transaction_management.py +3 -3
  8. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_05_snapshot_restore.py +4 -4
  9. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_06_sqlalchemy_integration.py +13 -9
  10. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_07_advanced_features.py +6 -6
  11. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_08_pubsub_operations.py +25 -11
  12. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_09_logger_integration.py +4 -4
  13. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_10_version_management.py +1 -1
  14. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_11_matrixone_version_demo.py +1 -1
  15. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_13_vector_indexes.py +1 -1
  16. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_18_snapshot_orm.py +4 -4
  17. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_19_sqlalchemy_style_orm.py +21 -12
  18. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_21_advanced_orm_features.py +1 -1
  19. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_22_unified_sql_builder.py +3 -2
  20. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_25_metadata_operations.py +4 -2
  21. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_dynamic_logging.py +3 -3
  22. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/async_client.py +24 -8
  23. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/async_vector_index_manager.py +3 -1
  24. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/client.py +61 -9
  25. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/restore.py +6 -2
  26. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/vector_index.py +28 -0
  27. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2/matrixone_python_sdk.egg-info}/PKG-INFO +17 -1
  28. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/pyproject.toml +1 -1
  29. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/LICENSE +0 -0
  30. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/MANIFEST.in +0 -0
  31. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_12_vector_basics.py +0 -0
  32. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_14_vector_search.py +0 -0
  33. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_15_vector_advanced.py +0 -0
  34. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_20_sqlalchemy_engine_integration.py +0 -0
  35. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_24_query_update.py +0 -0
  36. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_connection_hooks.py +0 -0
  37. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/examples/example_ivf_stats_complete.py +0 -0
  38. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/__init__.py +0 -0
  39. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/account.py +0 -0
  40. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/async_metadata_manager.py +0 -0
  41. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/async_orm.py +0 -0
  42. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/base_client.py +0 -0
  43. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/config.py +0 -0
  44. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/connection_hooks.py +0 -0
  45. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/exceptions.py +0 -0
  46. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/logger.py +0 -0
  47. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/metadata.py +0 -0
  48. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/moctl.py +0 -0
  49. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/orm.py +0 -0
  50. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/pitr.py +0 -0
  51. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/pubsub.py +0 -0
  52. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/search_vector_index.py +0 -0
  53. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/snapshot.py +0 -0
  54. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sql_builder.py +0 -0
  55. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/__init__.py +0 -0
  56. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/adapters.py +0 -0
  57. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/dialect.py +0 -0
  58. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/fulltext_index.py +0 -0
  59. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/fulltext_search.py +0 -0
  60. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/hnsw_config.py +0 -0
  61. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/ivf_config.py +0 -0
  62. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/table_builder.py +0 -0
  63. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/sqlalchemy_ext/vector_type.py +0 -0
  64. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone/version.py +0 -0
  65. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone_python_sdk.egg-info/SOURCES.txt +0 -0
  66. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone_python_sdk.egg-info/dependency_links.txt +0 -0
  67. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone_python_sdk.egg-info/entry_points.txt +0 -0
  68. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone_python_sdk.egg-info/not-zip-safe +0 -0
  69. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone_python_sdk.egg-info/requires.txt +0 -0
  70. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/matrixone_python_sdk.egg-info/top_level.txt +0 -0
  71. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/requirements.txt +0 -0
  72. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/setup.cfg +0 -0
  73. {matrixone_python_sdk-0.1.0 → matrixone_python_sdk-0.1.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrixone-python-sdk
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A comprehensive Python SDK for MatrixOne database operations with vector search, fulltext search, and advanced features
5
5
  Home-page: https://github.com/matrixorigin/matrixone
6
6
  Author: MatrixOne Team
@@ -185,6 +185,22 @@ print(f"MatrixOne version: {version}")
185
185
  client.disconnect()
186
186
  ```
187
187
 
188
+ > **📝 Connection Parameters**
189
+ >
190
+ > The `connect()` method requires **keyword arguments** (not positional):
191
+ > - `database` - **Required**, no default value
192
+ > - `host` - Default: `'localhost'`
193
+ > - `port` - Default: `6001`
194
+ > - `user` - Default: `'root'`
195
+ > - `password` - Default: `'111'`
196
+ >
197
+ > **Minimal connection** (uses all defaults):
198
+ > ```python
199
+ > client.connect(database='test')
200
+ > ```
201
+ >
202
+ > By default, all features (IVF, HNSW, fulltext) are automatically enabled via `on_connect=[ConnectionAction.ENABLE_ALL]`.
203
+
188
204
  ### Async Usage
189
205
 
190
206
  ```python
@@ -143,6 +143,22 @@ print(f"MatrixOne version: {version}")
143
143
  client.disconnect()
144
144
  ```
145
145
 
146
+ > **📝 Connection Parameters**
147
+ >
148
+ > The `connect()` method requires **keyword arguments** (not positional):
149
+ > - `database` - **Required**, no default value
150
+ > - `host` - Default: `'localhost'`
151
+ > - `port` - Default: `6001`
152
+ > - `user` - Default: `'root'`
153
+ > - `password` - Default: `'111'`
154
+ >
155
+ > **Minimal connection** (uses all defaults):
156
+ > ```python
157
+ > client.connect(database='test')
158
+ > ```
159
+ >
160
+ > By default, all features (IVF, HNSW, fulltext) are automatically enabled via `on_connect=[ConnectionAction.ENABLE_ALL]`.
161
+
146
162
  ### Async Usage
147
163
 
148
164
  ```python
@@ -120,6 +120,22 @@ print(f"MatrixOne version: {version}")
120
120
  client.disconnect()
121
121
  ```
122
122
 
123
+ > **📝 Connection Parameters**
124
+ >
125
+ > The `connect()` method requires **keyword arguments** (not positional):
126
+ > - `database` - **Required**, no default value
127
+ > - `host` - Default: `'localhost'`
128
+ > - `port` - Default: `6001`
129
+ > - `user` - Default: `'root'`
130
+ > - `password` - Default: `'111'`
131
+ >
132
+ > **Minimal connection** (uses all defaults):
133
+ > ```python
134
+ > client.connect(database='test')
135
+ > ```
136
+ >
137
+ > By default, all features (IVF, HNSW, fulltext) are automatically enabled via `on_connect=[ConnectionAction.ENABLE_ALL]`.
138
+
123
139
  ### Async Usage
124
140
 
125
141
  ```python
@@ -66,7 +66,7 @@ class BasicConnectionDemo:
66
66
  # Test 1: Simple connection
67
67
  self.logger.info("Test 1: Simple Connection")
68
68
  client = Client(logger=self.logger, sql_log_mode="full")
69
- client.connect(host, port, user, password, database)
69
+ client.connect(host=host, port=port, user=user, password=password, database=database)
70
70
  self.logger.info("✅ Basic connection successful")
71
71
 
72
72
  # Test basic query
@@ -99,7 +99,7 @@ class BasicConnectionDemo:
99
99
  # Format 1: Legacy format (simple username)
100
100
  self.logger.info("Format 1: Legacy format (simple username)")
101
101
  client = Client(logger=self.logger, sql_log_mode="auto")
102
- client.connect(host, port, user, password, database)
102
+ client.connect(host=host, port=port, user=user, password=password, database=database)
103
103
  login_info = client.get_login_info()
104
104
  self.logger.info(f" ✅ Login info: {login_info}")
105
105
  client.disconnect()
@@ -107,7 +107,7 @@ class BasicConnectionDemo:
107
107
  # Format 2: Direct format (account#user)
108
108
  self.logger.info("Format 2: Direct format (account#user)")
109
109
  client = Client(logger=self.logger, sql_log_mode="auto")
110
- client.connect(host, port, 'sys#root', password, database)
110
+ client.connect(host=host, port=port, user='sys#root', password=password, database=database)
111
111
  login_info = client.get_login_info()
112
112
  self.logger.info(f" ✅ Login info: {login_info}")
113
113
  client.disconnect()
@@ -116,7 +116,7 @@ class BasicConnectionDemo:
116
116
  self.logger.info("Format 3: User with role (separate parameters)")
117
117
  try:
118
118
  client = Client(logger=self.logger, sql_log_mode="auto")
119
- client.connect(host, port, user, password, database, role='admin')
119
+ client.connect(host=host, port=port, user=user, password=password, database=database, role='admin')
120
120
  # Try to execute a query to trigger role validation
121
121
  client.execute("SELECT 1")
122
122
  login_info = client.get_login_info()
@@ -128,7 +128,7 @@ class BasicConnectionDemo:
128
128
  # Format 4: Account with separate parameters
129
129
  self.logger.info("Format 4: Account with separate parameters")
130
130
  client = Client(logger=self.logger, sql_log_mode="auto")
131
- client.connect(host, port, user, password, database, account='sys')
131
+ client.connect(host=host, port=port, user=user, password=password, database=database, account='sys')
132
132
  login_info = client.get_login_info()
133
133
  self.logger.info(f" ✅ Login info: {login_info}")
134
134
  client.disconnect()
@@ -154,7 +154,7 @@ class BasicConnectionDemo:
154
154
  self.logger.info("Test invalid credentials")
155
155
  try:
156
156
  client = Client(logger=self.logger, sql_log_mode="auto")
157
- client.connect(host, port, 'invalid_user', 'invalid_pass', database)
157
+ client.connect(host=host, port=port, user='invalid_user', password='invalid_pass', database=database)
158
158
  # Try to execute a query to trigger authentication
159
159
  client.execute("SELECT 1")
160
160
  self.logger.error(" ❌ Should have failed but didn't!")
@@ -165,7 +165,7 @@ class BasicConnectionDemo:
165
165
  self.logger.info("Test invalid host")
166
166
  try:
167
167
  client = Client(logger=self.logger, sql_log_mode="auto")
168
- client.connect('192.168.1.999', port, user, password, database)
168
+ client.connect(host='192.168.1.999', port=port, user=user, password=password, database=database)
169
169
  # Try to execute a query to trigger connection validation
170
170
  client.execute("SELECT 1")
171
171
  self.logger.error(" ❌ Should have failed but didn't!")
@@ -176,7 +176,7 @@ class BasicConnectionDemo:
176
176
  self.logger.info("Test invalid port")
177
177
  try:
178
178
  client = Client(logger=self.logger, sql_log_mode="auto")
179
- client.connect(host, 9999, user, password, database)
179
+ client.connect(host=host, port=9999, user=user, password=password, database=database)
180
180
  # Try to execute a query to trigger connection validation
181
181
  client.execute("SELECT 1")
182
182
  self.logger.error(" ❌ Should have failed but didn't!")
@@ -234,7 +234,7 @@ def demo_connection_info():
234
234
 
235
235
  try:
236
236
  client = Client(logger=logger, sql_log_mode="auto")
237
- client.connect(host, port, user, password, database)
237
+ client.connect(host=host, port=port, user=user, password=password, database=database)
238
238
 
239
239
  # Get login info
240
240
  login_info = client.get_login_info()
@@ -266,7 +266,7 @@ async def demo_async_connection():
266
266
  client = None
267
267
  try:
268
268
  client = AsyncClient(logger=logger)
269
- await client.connect(host, port, user, password, database)
269
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
270
270
  logger.info("✅ Async connection successful")
271
271
 
272
272
  # Test async query
@@ -300,7 +300,7 @@ def demo_connection_pooling():
300
300
  # Create multiple connections
301
301
  for i in range(3):
302
302
  client = Client(logger=logger, sql_log_mode="auto")
303
- client.connect(host, port, user, password, database)
303
+ client.connect(host=host, port=port, user=user, password=password, database=database)
304
304
  clients.append(client)
305
305
  logger.info(f" ✅ Created connection {i+1}")
306
306
 
@@ -67,7 +67,7 @@ class AccountManagementDemo:
67
67
 
68
68
  # Connect as root for account management
69
69
  root_client = Client(logger=self.logger, sql_log_mode="full")
70
- root_client.connect(host, port, user, password, database)
70
+ root_client.connect(host=host, port=port, user=user, password=password, database=database)
71
71
  account_manager = AccountManager(root_client)
72
72
 
73
73
  # Clean up any existing demo accounts
@@ -112,7 +112,9 @@ class AccountManagementDemo:
112
112
  try:
113
113
  # Connect as demo account admin
114
114
  demo_admin_client = Client(sql_log_mode="full")
115
- demo_admin_client.connect(host, port, 'demo_account#demo_admin', 'adminpass123', 'mo_catalog')
115
+ demo_admin_client.connect(
116
+ host=host, port=port, user='demo_account#demo_admin', password='adminpass123', database='mo_catalog'
117
+ )
116
118
  demo_account_manager = AccountManager(demo_admin_client)
117
119
 
118
120
  # Create users
@@ -145,7 +147,9 @@ class AccountManagementDemo:
145
147
  try:
146
148
  # Connect as demo account admin
147
149
  demo_admin_client = Client(sql_log_mode="full")
148
- demo_admin_client.connect(host, port, 'demo_account#demo_admin', 'adminpass123', 'mo_catalog')
150
+ demo_admin_client.connect(
151
+ host=host, port=port, user='demo_account#demo_admin', password='adminpass123', database='mo_catalog'
152
+ )
149
153
  demo_account_manager = AccountManager(demo_admin_client)
150
154
 
151
155
  # Create roles
@@ -219,7 +223,7 @@ class AccountManagementDemo:
219
223
 
220
224
  # Connect as root
221
225
  root_client = AsyncClient(sql_log_mode="full")
222
- await root_client.connect(host, port, user, password, database)
226
+ await root_client.connect(host=host, port=port, user=user, password=password, database=database)
223
227
  self.logger.info("✅ Async connection successful")
224
228
 
225
229
  # Test basic async operations
@@ -67,7 +67,7 @@ class AsyncOperationsDemo:
67
67
  self.logger.info("Test 1: Basic Async Connection")
68
68
  try:
69
69
  client = AsyncClient(logger=self.logger, sql_log_mode="full")
70
- await client.connect(host, port, user, password, database)
70
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
71
71
  self.logger.info("✅ Async connection successful")
72
72
 
73
73
  # Test basic async query
@@ -107,7 +107,7 @@ class AsyncOperationsDemo:
107
107
  self.logger.info("Test: Async Query Execution")
108
108
  try:
109
109
  client = AsyncClient(logger=self.logger, sql_log_mode="full")
110
- await client.connect(host, port, user, password, database)
110
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
111
111
 
112
112
  # Test various query types
113
113
  queries = [
@@ -149,7 +149,7 @@ class AsyncOperationsDemo:
149
149
  self.logger.info("Test: Async Transaction Management")
150
150
  try:
151
151
  client = AsyncClient(logger=self.logger, sql_log_mode="full")
152
- await client.connect(host, port, user, password, database)
152
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
153
153
 
154
154
  # Test transaction operations
155
155
  await client.execute("START TRANSACTION")
@@ -193,7 +193,7 @@ class AsyncOperationsDemo:
193
193
  clients = []
194
194
  for i in range(3):
195
195
  client = AsyncClient(logger=self.logger, sql_log_mode="full")
196
- await client.connect(host, port, user, password, database)
196
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
197
197
  clients.append(client)
198
198
  self.logger.info(f" ✅ Created async connection {i+1}")
199
199
 
@@ -239,7 +239,7 @@ class AsyncOperationsDemo:
239
239
  self.logger.info("Test: Async Error Handling")
240
240
  try:
241
241
  client = AsyncClient(logger=self.logger, sql_log_mode="full")
242
- await client.connect(host, port, user, password, database)
242
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
243
243
 
244
244
  # Test invalid query (should raise error)
245
245
  try:
@@ -59,7 +59,7 @@ class TransactionManagementDemo:
59
59
  host, port, user, password, database = get_connection_params()
60
60
 
61
61
  client = Client(logger=self.logger, sql_log_mode="full")
62
- client.connect(host, port, user, password, database)
62
+ client.connect(host=host, port=port, user=user, password=password, database=database)
63
63
 
64
64
  # Test 1: Simple transaction with commit
65
65
  self.logger.info("Test 1: Simple Transaction with Commit")
@@ -163,7 +163,7 @@ class TransactionManagementDemo:
163
163
  host, port, user, password, database = get_connection_params()
164
164
 
165
165
  client = Client(logger=self.logger, sql_log_mode="full")
166
- client.connect(host, port, user, password, database)
166
+ client.connect(host=host, port=port, user=user, password=password, database=database)
167
167
 
168
168
  # Test error handling in transaction
169
169
  self.logger.info("Test: Transaction Error Handling")
@@ -236,7 +236,7 @@ class TransactionManagementDemo:
236
236
  host, port, user, password, database = get_connection_params()
237
237
 
238
238
  client = AsyncClient(logger=self.logger, sql_log_mode="full")
239
- await client.connect(host, port, user, password, database)
239
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
240
240
 
241
241
  # Test async transaction
242
242
  self.logger.info("Test: Async Transaction Management")
@@ -59,7 +59,7 @@ class SnapshotRestoreDemo:
59
59
  host, port, user, password, database = get_connection_params()
60
60
 
61
61
  client = Client(logger=self.logger, sql_log_mode="full")
62
- client.connect(host, port, user, password, database)
62
+ client.connect(host=host, port=port, user=user, password=password, database=database)
63
63
 
64
64
  # Test 1: Create test data
65
65
  self.logger.info("Test 1: Create Test Data")
@@ -186,7 +186,7 @@ class SnapshotRestoreDemo:
186
186
  host, port, user, password, database = get_connection_params()
187
187
 
188
188
  client = Client(logger=self.logger, sql_log_mode="full")
189
- client.connect(host, port, user, password, database)
189
+ client.connect(host=host, port=port, user=user, password=password, database=database)
190
190
 
191
191
  # Test snapshot enumeration
192
192
  self.logger.info("Test: Snapshot Enumeration")
@@ -223,7 +223,7 @@ class SnapshotRestoreDemo:
223
223
  host, port, user, password, database = get_connection_params()
224
224
 
225
225
  client = Client(logger=self.logger, sql_log_mode="full")
226
- client.connect(host, port, user, password, database)
226
+ client.connect(host=host, port=port, user=user, password=password, database=database)
227
227
 
228
228
  # Test error handling
229
229
  self.logger.info("Test: Snapshot Error Handling")
@@ -266,7 +266,7 @@ class SnapshotRestoreDemo:
266
266
  host, port, user, password, database = get_connection_params()
267
267
 
268
268
  client = AsyncClient(logger=self.logger, sql_log_mode="full")
269
- await client.connect(host, port, user, password, database)
269
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
270
270
 
271
271
  # Test async snapshot operations
272
272
  self.logger.info("Test: Async Snapshot Operations")
@@ -30,8 +30,8 @@ This example shows the complete SQLAlchemy integration capabilities.
30
30
 
31
31
  import logging
32
32
  import asyncio
33
- from sqlalchemy import create_engine, Column, Integer, String, DateTime, Text, ForeignKey, text
34
- from sqlalchemy.orm import declarative_base, sessionmaker, relationship
33
+ from sqlalchemy import create_engine, Column, Integer, String, DateTime, Text, ForeignKey, text, and_
34
+ from sqlalchemy.orm import declarative_base, sessionmaker, relationship, foreign
35
35
  from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
36
36
  from sqlalchemy.pool import QueuePool
37
37
  from matrixone import Client, AsyncClient
@@ -67,8 +67,8 @@ class User(Base):
67
67
  email = Column(String(100), unique=True, nullable=False)
68
68
  created_at = Column(DateTime)
69
69
 
70
- # Relationship
71
- posts = relationship("Post", back_populates="author")
70
+ # Relationship (ORM-level only)
71
+ posts = relationship("Post", back_populates="author", primaryjoin="User.id==foreign(Post.author_id)")
72
72
 
73
73
 
74
74
  class Post(Base):
@@ -77,11 +77,13 @@ class Post(Base):
77
77
  id = Column(Integer, primary_key=True)
78
78
  title = Column(String(200), nullable=False)
79
79
  content = Column(Text)
80
- author_id = Column(Integer, ForeignKey('users.id'))
80
+ # Note: MatrixOne may have limitations with foreign key constraints
81
+ # Using Integer column without FK constraint, but keeping ORM relationship
82
+ author_id = Column(Integer)
81
83
  created_at = Column(DateTime)
82
84
 
83
- # Relationship
84
- author = relationship("User", back_populates="posts")
85
+ # Relationship (ORM-level only, no database FK constraint)
86
+ author = relationship("User", back_populates="posts", primaryjoin="foreign(Post.author_id)==User.id")
85
87
 
86
88
 
87
89
  class SQLAlchemyIntegrationDemo:
@@ -156,7 +158,8 @@ class SQLAlchemyIntegrationDemo:
156
158
  # Test ORM operations
157
159
  self.logger.info("Test: ORM Operations")
158
160
  try:
159
- # Create tables
161
+ # Drop and recreate tables to ensure clean state
162
+ Base.metadata.drop_all(engine)
160
163
  Base.metadata.create_all(engine)
161
164
  self.logger.info(" Created tables")
162
165
 
@@ -218,7 +221,8 @@ class SQLAlchemyIntegrationDemo:
218
221
  # Test transactions
219
222
  self.logger.info("Test: SQLAlchemy Transactions")
220
223
  try:
221
- # Create tables
224
+ # Drop and recreate tables to ensure clean state
225
+ Base.metadata.drop_all(engine)
222
226
  Base.metadata.create_all(engine)
223
227
 
224
228
  # Test transaction with commit
@@ -64,7 +64,7 @@ class AdvancedFeaturesDemo:
64
64
  host, port, user, password, database = get_connection_params()
65
65
 
66
66
  client = Client(logger=self.logger, sql_log_mode="full")
67
- client.connect(host, port, user, password, database)
67
+ client.connect(host=host, port=port, user=user, password=password, database=database)
68
68
 
69
69
  # Test PubSub operations
70
70
  self.logger.info("Test: PubSub Operations")
@@ -111,7 +111,7 @@ class AdvancedFeaturesDemo:
111
111
  host, port, user, password, database = get_connection_params()
112
112
 
113
113
  client = Client(logger=self.logger, sql_log_mode="full")
114
- client.connect(host, port, user, password, database)
114
+ client.connect(host=host, port=port, user=user, password=password, database=database)
115
115
 
116
116
  # Test clone operations
117
117
  self.logger.info("Test: Clone Operations")
@@ -157,7 +157,7 @@ class AdvancedFeaturesDemo:
157
157
  host, port, user, password, database = get_connection_params()
158
158
 
159
159
  client = Client(logger=self.logger, sql_log_mode="full")
160
- client.connect(host, port, user, password, database)
160
+ client.connect(host=host, port=port, user=user, password=password, database=database)
161
161
 
162
162
  # Test MoCTL integration
163
163
  self.logger.info("Test: MoCTL Integration")
@@ -202,7 +202,7 @@ class AdvancedFeaturesDemo:
202
202
  host, port, user, password, database = get_connection_params()
203
203
 
204
204
  client = Client(logger=self.logger, sql_log_mode="full")
205
- client.connect(host, port, user, password, database)
205
+ client.connect(host=host, port=port, user=user, password=password, database=database)
206
206
 
207
207
  # Test version information
208
208
  self.logger.info("Test: Version Information")
@@ -251,7 +251,7 @@ class AdvancedFeaturesDemo:
251
251
  host, port, user, password, database = get_connection_params()
252
252
 
253
253
  client = Client(logger=self.logger, sql_log_mode="full")
254
- client.connect(host, port, user, password, database)
254
+ client.connect(host=host, port=port, user=user, password=password, database=database)
255
255
 
256
256
  # Test performance monitoring
257
257
  self.logger.info("Test: Performance Monitoring")
@@ -297,7 +297,7 @@ class AdvancedFeaturesDemo:
297
297
  host, port, user, password, database = get_connection_params()
298
298
 
299
299
  client = AsyncClient(logger=self.logger, sql_log_mode="full")
300
- await client.connect(host, port, user, password, database)
300
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
301
301
 
302
302
  # Test async advanced features
303
303
  self.logger.info("Test: Async Advanced Features")
@@ -62,7 +62,7 @@ class PubSubOperationsDemo:
62
62
  host, port, user, password, database = get_connection_params()
63
63
 
64
64
  client = Client(sql_log_mode="full")
65
- client.connect(host, port, user, password, database)
65
+ client.connect(host=host, port=port, user=user, password=password, database=database)
66
66
 
67
67
  # Test basic PubSub operations
68
68
  self.logger.info("Test: Basic PubSub Operations")
@@ -145,7 +145,7 @@ def demo_cross_account_pubsub():
145
145
 
146
146
  try:
147
147
  # Connect as admin
148
- admin_client.connect(host, port, user, password, "mo_catalog")
148
+ admin_client.connect(host=host, port=port, user=user, password=password, database="mo_catalog")
149
149
  logger.info("✅ Connected as admin")
150
150
 
151
151
  # Clean up any existing accounts first
@@ -193,23 +193,31 @@ def demo_cross_account_pubsub():
193
193
  publisher_client = Client(sql_log_mode="full")
194
194
 
195
195
  # Connect as publisher account admin
196
- publisher_client.connect(host, port, "pub_publisher#pub_admin", "pub_pass", "mo_catalog")
196
+ publisher_client.connect(
197
+ host=host, port=port, user="pub_publisher#pub_admin", password="pub_pass", database="mo_catalog"
198
+ )
197
199
  logger.info(" ✅ Connected as publisher account admin")
198
200
 
199
201
  # Create publisher database
200
202
  pub_admin_client = Client(sql_log_mode="full")
201
- pub_admin_client.connect(host, port, "pub_publisher#pub_admin", "pub_pass", "mo_catalog")
203
+ pub_admin_client.connect(
204
+ host=host, port=port, user="pub_publisher#pub_admin", password="pub_pass", database="mo_catalog"
205
+ )
202
206
  pub_admin_client.execute("CREATE DATABASE IF NOT EXISTS publisher_data")
203
207
  pub_admin_client.disconnect()
204
208
 
205
209
  # Connect to publisher database
206
210
  publisher_client.disconnect()
207
- publisher_client.connect(host, port, "pub_publisher#pub_admin", "pub_pass", "publisher_data")
211
+ publisher_client.connect(
212
+ host=host, port=port, user="pub_publisher#pub_admin", password="pub_pass", database="publisher_data"
213
+ )
208
214
  logger.info(" ✅ Connected to publisher database")
209
215
 
210
216
  # Create tables for publishing
211
217
  pub_admin_client = Client(sql_log_mode="full")
212
- pub_admin_client.connect(host, port, "pub_publisher#pub_admin", "pub_pass", "publisher_data")
218
+ pub_admin_client.connect(
219
+ host=host, port=port, user="pub_publisher#pub_admin", password="pub_pass", database="publisher_data"
220
+ )
213
221
 
214
222
  pub_admin_client.execute(
215
223
  """
@@ -281,7 +289,9 @@ def demo_cross_account_pubsub():
281
289
  subscriber_client = Client(sql_log_mode="full")
282
290
 
283
291
  # Connect as subscriber account admin
284
- subscriber_client.connect(host, port, "pub_subscriber#sub_admin", "sub_pass", "mo_catalog")
292
+ subscriber_client.connect(
293
+ host=host, port=port, user="pub_subscriber#sub_admin", password="sub_pass", database="mo_catalog"
294
+ )
285
295
  logger.info(" ✅ Connected as subscriber account admin")
286
296
 
287
297
  # Create subscriptions
@@ -300,7 +310,9 @@ def demo_cross_account_pubsub():
300
310
 
301
311
  # Add new data as publisher
302
312
  pub_admin_client = Client(sql_log_mode="full")
303
- pub_admin_client.connect(host, port, "pub_publisher#pub_admin", "pub_pass", "publisher_data")
313
+ pub_admin_client.connect(
314
+ host=host, port=port, user="pub_publisher#pub_admin", password="pub_pass", database="publisher_data"
315
+ )
304
316
 
305
317
  pub_admin_client.execute(f"INSERT INTO sales_data (product_name, quantity, price) VALUES ('Apple Watch', 3, 399.99)")
306
318
  logger.info(" 📤 Added new sales data: Apple Watch")
@@ -334,7 +346,9 @@ def demo_cross_account_pubsub():
334
346
  try:
335
347
  # Create new connection for cleanup
336
348
  cleanup_client = Client(sql_log_mode="full")
337
- cleanup_client.connect(host, port, "pub_publisher#pub_admin", "pub_pass", "mo_catalog")
349
+ cleanup_client.connect(
350
+ host=host, port=port, user="pub_publisher#pub_admin", password="pub_pass", database="mo_catalog"
351
+ )
338
352
  cleanup_client.execute("DROP DATABASE publisher_data")
339
353
  cleanup_client.disconnect()
340
354
  logger.info(" ✅ Dropped publisher database")
@@ -376,7 +390,7 @@ async def demo_async_pubsub_operations():
376
390
 
377
391
  try:
378
392
  # Connect to MatrixOne
379
- await client.connect(host, port, user, password, database)
393
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
380
394
  logger.info("✅ Connected to MatrixOne (async)")
381
395
 
382
396
  # Create test database and tables
@@ -497,7 +511,7 @@ def demo_pubsub_best_practices():
497
511
 
498
512
  try:
499
513
  # Connect to MatrixOne
500
- client.connect(host, port, user, password, database)
514
+ client.connect(host=host, port=port, user=user, password=password, database=database)
501
515
  logger.info("✅ Connected to MatrixOne")
502
516
 
503
517
  # Create a realistic e-commerce scenario
@@ -71,7 +71,7 @@ class LoggerIntegrationDemo:
71
71
  self.logger.info("Test: Default Logger Configuration")
72
72
  try:
73
73
  # Connect to MatrixOne
74
- client.connect(host, port, user, password, database)
74
+ client.connect(host=host, port=port, user=user, password=password, database=database)
75
75
 
76
76
  # Execute some queries to see logging in action
77
77
  client.execute("SELECT 1 as test_value")
@@ -127,7 +127,7 @@ class LoggerIntegrationDemo:
127
127
  try:
128
128
  # Create client with custom logger
129
129
  client = Client(logger=custom_logger)
130
- client.connect(host, port, user, password, database)
130
+ client.connect(host=host, port=port, user=user, password=password, database=database)
131
131
 
132
132
  # Execute queries with custom logging
133
133
  client.execute("SELECT 1 as custom_test")
@@ -276,7 +276,7 @@ class LoggerIntegrationDemo:
276
276
  try:
277
277
  # Create client with auto SQL logging
278
278
  client = Client(sql_log_mode="auto")
279
- client.connect(host, port, user, password, database)
279
+ client.connect(host=host, port=port, user=user, password=password, database=database)
280
280
 
281
281
  # Execute queries to test performance logging
282
282
  client.execute("SELECT 1 as performance_test")
@@ -312,7 +312,7 @@ class LoggerIntegrationDemo:
312
312
  try:
313
313
  # Create async client with auto SQL logging
314
314
  client = AsyncClient(sql_log_mode="auto")
315
- await client.connect(host, port, user, password, database)
315
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
316
316
 
317
317
  # Execute async queries
318
318
  await client.execute("SELECT 1 as async_test")
@@ -118,7 +118,7 @@ class VersionManagementDemo:
118
118
  print("Test: Backend Version Detection")
119
119
  try:
120
120
  client = Client()
121
- client.connect(host, port, user, password, database)
121
+ client.connect(host=host, port=port, user=user, password=password, database=database)
122
122
 
123
123
  # Get version information
124
124
  version_info = client.version()
@@ -231,7 +231,7 @@ class MatrixOneVersionDemo:
231
231
  from matrixone import Client
232
232
 
233
233
  client = Client()
234
- client.connect(host, port, user, password, database)
234
+ client.connect(host=host, port=port, user=user, password=password, database=database)
235
235
 
236
236
  # Get version information
237
237
  version_info = client.version()
@@ -554,7 +554,7 @@ class VectorIndexDemo:
554
554
  # Create async client
555
555
  host, port, user, password, database = get_connection_params()
556
556
  async_client = AsyncClient()
557
- await async_client.connect(host, port, user, password, database)
557
+ await async_client.connect(host=host, port=port, user=user, password=password, database=database)
558
558
 
559
559
  try:
560
560
  # Enable fulltext indexing
@@ -56,7 +56,7 @@ class SnapshotORMDemo:
56
56
  host, port, user, password, database = get_connection_params()
57
57
 
58
58
  client = Client(logger=self.logger)
59
- client.connect(host, port, user, password, database)
59
+ client.connect(host=host, port=port, user=user, password=password, database=database)
60
60
 
61
61
  # Test sync snapshot ORM
62
62
  self.logger.info("Test: Sync Snapshot ORM")
@@ -144,7 +144,7 @@ class SnapshotORMDemo:
144
144
  host, port, user, password, database = get_connection_params()
145
145
 
146
146
  client = AsyncClient(logger=self.logger)
147
- await client.connect(host, port, user, password, database)
147
+ await client.connect(host=host, port=port, user=user, password=password, database=database)
148
148
 
149
149
  # Test async snapshot ORM
150
150
  self.logger.info("Test: Async Snapshot ORM")
@@ -225,7 +225,7 @@ class SnapshotORMDemo:
225
225
  host, port, user, password, database = get_connection_params()
226
226
 
227
227
  client = Client(logger=self.logger)
228
- client.connect(host, port, user, password, database)
228
+ client.connect(host=host, port=port, user=user, password=password, database=database)
229
229
 
230
230
  # Test complex snapshot queries
231
231
  self.logger.info("Test: Complex Snapshot Queries")
@@ -320,7 +320,7 @@ class SnapshotORMDemo:
320
320
  host, port, user, password, database = get_connection_params()
321
321
 
322
322
  client = Client(logger=self.logger)
323
- client.connect(host, port, user, password, database)
323
+ client.connect(host=host, port=port, user=user, password=password, database=database)
324
324
 
325
325
  # Test snapshot query builder methods
326
326
  self.logger.info("Test: Snapshot Query Builder Methods")