matrixone-python-sdk 0.1.3__tar.gz → 0.1.4__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 (74) hide show
  1. {matrixone_python_sdk-0.1.3/matrixone_python_sdk.egg-info → matrixone_python_sdk-0.1.4}/PKG-INFO +1 -1
  2. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/async_client.py +10 -4
  3. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/client.py +10 -4
  4. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/connection_hooks.py +7 -7
  5. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/index_utils.py +40 -18
  6. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4/matrixone_python_sdk.egg-info}/PKG-INFO +1 -1
  7. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/pyproject.toml +1 -1
  8. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/LICENSE +0 -0
  9. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/MANIFEST.in +0 -0
  10. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/README.md +0 -0
  11. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/README_USER.md +0 -0
  12. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_01_basic_connection.py +0 -0
  13. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_02_account_management.py +0 -0
  14. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_03_async_operations.py +0 -0
  15. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_04_transaction_management.py +0 -0
  16. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_05_snapshot_restore.py +0 -0
  17. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_06_sqlalchemy_integration.py +0 -0
  18. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_07_advanced_features.py +0 -0
  19. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_08_pubsub_operations.py +0 -0
  20. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_09_logger_integration.py +0 -0
  21. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_10_version_management.py +0 -0
  22. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_11_matrixone_version_demo.py +0 -0
  23. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_12_vector_basics.py +0 -0
  24. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_13_vector_indexes.py +0 -0
  25. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_14_vector_search.py +0 -0
  26. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_15_vector_advanced.py +0 -0
  27. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_18_snapshot_orm.py +0 -0
  28. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_19_sqlalchemy_style_orm.py +0 -0
  29. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_20_sqlalchemy_engine_integration.py +0 -0
  30. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_21_advanced_orm_features.py +0 -0
  31. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_22_unified_sql_builder.py +0 -0
  32. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_24_query_update.py +0 -0
  33. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_25_metadata_operations.py +0 -0
  34. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_connection_hooks.py +0 -0
  35. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_dynamic_logging.py +0 -0
  36. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/examples/example_ivf_stats_complete.py +0 -0
  37. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/__init__.py +0 -0
  38. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/account.py +0 -0
  39. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/async_metadata_manager.py +0 -0
  40. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/async_orm.py +0 -0
  41. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/async_vector_index_manager.py +0 -0
  42. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/base_client.py +0 -0
  43. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/config.py +0 -0
  44. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/exceptions.py +0 -0
  45. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/logger.py +0 -0
  46. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/metadata.py +0 -0
  47. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/moctl.py +0 -0
  48. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/orm.py +0 -0
  49. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/pitr.py +0 -0
  50. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/pubsub.py +0 -0
  51. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/restore.py +0 -0
  52. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/search_vector_index.py +0 -0
  53. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/snapshot.py +0 -0
  54. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sql_builder.py +0 -0
  55. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/__init__.py +0 -0
  56. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/adapters.py +0 -0
  57. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/dialect.py +0 -0
  58. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/fulltext_index.py +0 -0
  59. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/fulltext_search.py +0 -0
  60. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/hnsw_config.py +0 -0
  61. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/ivf_config.py +0 -0
  62. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/table_builder.py +0 -0
  63. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/vector_index.py +0 -0
  64. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/sqlalchemy_ext/vector_type.py +0 -0
  65. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone/version.py +0 -0
  66. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone_python_sdk.egg-info/SOURCES.txt +0 -0
  67. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone_python_sdk.egg-info/dependency_links.txt +0 -0
  68. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone_python_sdk.egg-info/entry_points.txt +0 -0
  69. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone_python_sdk.egg-info/not-zip-safe +0 -0
  70. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone_python_sdk.egg-info/requires.txt +0 -0
  71. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/matrixone_python_sdk.egg-info/top_level.txt +0 -0
  72. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/requirements.txt +0 -0
  73. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/setup.cfg +0 -0
  74. {matrixone_python_sdk-0.1.3 → matrixone_python_sdk-0.1.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrixone-python-sdk
3
- Version: 0.1.3
3
+ Version: 0.1.4
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
@@ -2556,7 +2556,7 @@ class AsyncClient(BaseMatrixOneClient):
2556
2556
 
2557
2557
  async def get_secondary_index_tables(self, table_name: str) -> List[str]:
2558
2558
  """
2559
- Get all secondary index table names for a given table (async version).
2559
+ Get all secondary index table names for a given table in the current database (async version).
2560
2560
 
2561
2561
  Args:
2562
2562
  table_name: Name of the table to get secondary indexes for
@@ -2573,13 +2573,16 @@ class AsyncClient(BaseMatrixOneClient):
2573
2573
  """
2574
2574
  from .index_utils import build_get_index_tables_sql
2575
2575
 
2576
- sql, params = build_get_index_tables_sql(table_name)
2576
+ # Get current database from connection params
2577
+ database = self._connection_params.get('database') if hasattr(self, '_connection_params') else None
2578
+
2579
+ sql, params = build_get_index_tables_sql(table_name, database)
2577
2580
  result = await self.execute(sql, params)
2578
2581
  return [row[0] for row in result.fetchall()]
2579
2582
 
2580
2583
  async def get_secondary_index_table_by_name(self, table_name: str, index_name: str) -> Optional[str]:
2581
2584
  """
2582
- Get the physical table name of a secondary index by its index name (async version).
2585
+ Get the physical table name of a secondary index by its index name in the current database (async version).
2583
2586
 
2584
2587
  Args:
2585
2588
  table_name: Name of the table
@@ -2597,7 +2600,10 @@ class AsyncClient(BaseMatrixOneClient):
2597
2600
  """
2598
2601
  from .index_utils import build_get_index_table_by_name_sql
2599
2602
 
2600
- sql, params = build_get_index_table_by_name_sql(table_name, index_name)
2603
+ # Get current database from connection params
2604
+ database = self._connection_params.get('database') if hasattr(self, '_connection_params') else None
2605
+
2606
+ sql, params = build_get_index_table_by_name_sql(table_name, index_name, database)
2601
2607
  result = await self.execute(sql, params)
2602
2608
  row = result.fetchone()
2603
2609
  return row[0] if row else None
@@ -2615,7 +2615,7 @@ class Client(BaseMatrixOneClient):
2615
2615
 
2616
2616
  def get_secondary_index_tables(self, table_name: str) -> List[str]:
2617
2617
  """
2618
- Get all secondary index table names for a given table.
2618
+ Get all secondary index table names for a given table in the current database.
2619
2619
 
2620
2620
  Args:
2621
2621
  table_name: Name of the table to get secondary indexes for
@@ -2633,13 +2633,16 @@ class Client(BaseMatrixOneClient):
2633
2633
  """
2634
2634
  from .index_utils import build_get_index_tables_sql
2635
2635
 
2636
- sql, params = build_get_index_tables_sql(table_name)
2636
+ # Get current database from connection params
2637
+ database = self._connection_params.get('database') if hasattr(self, '_connection_params') else None
2638
+
2639
+ sql, params = build_get_index_tables_sql(table_name, database)
2637
2640
  result = self.execute(sql, params)
2638
2641
  return [row[0] for row in result.fetchall()]
2639
2642
 
2640
2643
  def get_secondary_index_table_by_name(self, table_name: str, index_name: str) -> Optional[str]:
2641
2644
  """
2642
- Get the physical table name of a secondary index by its index name.
2645
+ Get the physical table name of a secondary index by its index name in the current database.
2643
2646
 
2644
2647
  Args:
2645
2648
  table_name: Name of the table
@@ -2658,7 +2661,10 @@ class Client(BaseMatrixOneClient):
2658
2661
  """
2659
2662
  from .index_utils import build_get_index_table_by_name_sql
2660
2663
 
2661
- sql, params = build_get_index_table_by_name_sql(table_name, index_name)
2664
+ # Get current database from connection params
2665
+ database = self._connection_params.get('database') if hasattr(self, '_connection_params') else None
2666
+
2667
+ sql, params = build_get_index_table_by_name_sql(table_name, index_name, database)
2662
2668
  result = self.execute(sql, params)
2663
2669
  row = result.fetchone()
2664
2670
  return row[0] if row else None
@@ -69,13 +69,13 @@ class ConnectionHook:
69
69
  event.listen(engine.sync_engine, "connect", self._on_connect_sync)
70
70
  event.listen(engine.sync_engine, "before_cursor_execute", self._on_before_cursor_execute)
71
71
  if hasattr(self._client_ref, 'logger'):
72
- self._client_ref.logger.info("Attached connection hook to async engine")
72
+ self._client_ref.logger.debug("Attached connection hook to async engine")
73
73
  else:
74
74
  # For sync engines, listen to both connect and before_cursor_execute events
75
75
  event.listen(engine, "connect", self._on_connect_sync)
76
76
  event.listen(engine, "before_cursor_execute", self._on_before_cursor_execute)
77
77
  if hasattr(self._client_ref, 'logger'):
78
- self._client_ref.logger.info("Attached connection hook to sync engine")
78
+ self._client_ref.logger.debug("Attached connection hook to sync engine")
79
79
 
80
80
  def _on_connect_sync(self, dbapi_connection, connection_record):
81
81
  """SQLAlchemy event handler for new connections (sync)"""
@@ -86,7 +86,7 @@ class ConnectionHook:
86
86
  try:
87
87
  # Log that the hook is being executed
88
88
  if hasattr(self._client_ref, 'logger'):
89
- self._client_ref.logger.info(f"Executing connection hook on new connection {conn_id}")
89
+ self._client_ref.logger.debug(f"Executing connection hook on new connection {conn_id}")
90
90
  # Pass the connection to avoid creating new connections
91
91
  self.execute_sync_with_connection(self._client_ref, dbapi_connection)
92
92
  self._executed_connections.add(conn_id)
@@ -104,7 +104,7 @@ class ConnectionHook:
104
104
  try:
105
105
  # Log that the hook is being executed
106
106
  if hasattr(self._client_ref, 'logger'):
107
- self._client_ref.logger.info(f"Executing connection hook on connection {conn_id}")
107
+ self._client_ref.logger.debug(f"Executing connection hook on connection {conn_id}")
108
108
  # Use the connection to avoid creating new connections
109
109
  self.execute_sync_with_connection(self._client_ref, conn.connection)
110
110
  self._executed_connections.add(conn_id)
@@ -212,7 +212,7 @@ class ConnectionHook:
212
212
  cursor = dbapi_connection.cursor()
213
213
  cursor.execute("SET experimental_ivf_index = 1")
214
214
  cursor.close()
215
- client.logger.info("✓ Enabled IVF vector operations")
215
+ client.logger.debug("✓ Enabled IVF vector operations")
216
216
  except Exception as e:
217
217
  client.logger.warning(f"Failed to enable IVF: {e}")
218
218
 
@@ -223,7 +223,7 @@ class ConnectionHook:
223
223
  cursor = dbapi_connection.cursor()
224
224
  cursor.execute("SET experimental_hnsw_index = 1")
225
225
  cursor.close()
226
- client.logger.info("✓ Enabled HNSW vector operations")
226
+ client.logger.debug("✓ Enabled HNSW vector operations")
227
227
  except Exception as e:
228
228
  client.logger.warning(f"Failed to enable HNSW: {e}")
229
229
 
@@ -234,7 +234,7 @@ class ConnectionHook:
234
234
  cursor = dbapi_connection.cursor()
235
235
  cursor.execute("SET experimental_fulltext_index = 1")
236
236
  cursor.close()
237
- client.logger.info("✓ Enabled fulltext search operations")
237
+ client.logger.debug("✓ Enabled fulltext search operations")
238
238
  except Exception as e:
239
239
  client.logger.warning(f"Failed to enable fulltext: {e}")
240
240
 
@@ -19,43 +19,65 @@ Index utilities - Shared logic for secondary index operations
19
19
  from typing import List, Tuple
20
20
 
21
21
 
22
- def build_get_index_tables_sql(table_name: str) -> Tuple[str, Tuple]:
22
+ def build_get_index_tables_sql(table_name: str, database: str = None) -> Tuple[str, Tuple]:
23
23
  """
24
24
  Build SQL to get all secondary index table names for a given table.
25
25
 
26
26
  Args:
27
27
  table_name: Name of the table
28
+ database: Name of the database (optional, but recommended to avoid cross-database conflicts)
28
29
 
29
30
  Returns:
30
31
  Tuple of (sql, params)
31
32
  """
32
- sql = """
33
- SELECT DISTINCT index_table_name
34
- FROM mo_catalog.mo_indexes
35
- JOIN mo_catalog.mo_tables ON mo_indexes.table_id = mo_tables.rel_id
36
- WHERE relname = ? AND type = 'MULTIPLE'
37
- """
38
- return sql, (table_name,)
39
-
40
-
41
- def build_get_index_table_by_name_sql(table_name: str, index_name: str) -> Tuple[str, Tuple]:
33
+ if database:
34
+ sql = """
35
+ SELECT DISTINCT index_table_name
36
+ FROM mo_catalog.mo_indexes
37
+ JOIN mo_catalog.mo_tables ON mo_indexes.table_id = mo_tables.rel_id
38
+ WHERE relname = ? AND reldatabase = ? AND type = 'MULTIPLE'
39
+ """
40
+ return sql, (table_name, database)
41
+ else:
42
+ # Fallback to old behavior if database is not provided
43
+ sql = """
44
+ SELECT DISTINCT index_table_name
45
+ FROM mo_catalog.mo_indexes
46
+ JOIN mo_catalog.mo_tables ON mo_indexes.table_id = mo_tables.rel_id
47
+ WHERE relname = ? AND type = 'MULTIPLE'
48
+ """
49
+ return sql, (table_name,)
50
+
51
+
52
+ def build_get_index_table_by_name_sql(table_name: str, index_name: str, database: str = None) -> Tuple[str, Tuple]:
42
53
  """
43
54
  Build SQL to get the physical table name of a secondary index by its index name.
44
55
 
45
56
  Args:
46
57
  table_name: Name of the table
47
58
  index_name: Name of the secondary index
59
+ database: Name of the database (optional, but recommended to avoid cross-database conflicts)
48
60
 
49
61
  Returns:
50
62
  Tuple of (sql, params)
51
63
  """
52
- sql = """
53
- SELECT DISTINCT index_table_name
54
- FROM mo_catalog.mo_indexes
55
- JOIN mo_catalog.mo_tables ON mo_indexes.table_id = mo_tables.rel_id
56
- WHERE relname = ? AND name = ?
57
- """
58
- return sql, (table_name, index_name)
64
+ if database:
65
+ sql = """
66
+ SELECT DISTINCT index_table_name
67
+ FROM mo_catalog.mo_indexes
68
+ JOIN mo_catalog.mo_tables ON mo_indexes.table_id = mo_tables.rel_id
69
+ WHERE relname = ? AND name = ? AND reldatabase = ?
70
+ """
71
+ return sql, (table_name, index_name, database)
72
+ else:
73
+ # Fallback to old behavior if database is not provided
74
+ sql = """
75
+ SELECT DISTINCT index_table_name
76
+ FROM mo_catalog.mo_indexes
77
+ JOIN mo_catalog.mo_tables ON mo_indexes.table_id = mo_tables.rel_id
78
+ WHERE relname = ? AND name = ?
79
+ """
80
+ return sql, (table_name, index_name)
59
81
 
60
82
 
61
83
  def build_verify_counts_sql(table_name: str, index_tables: List[str]) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrixone-python-sdk
3
- Version: 0.1.3
3
+ Version: 0.1.4
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "matrixone-python-sdk"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "A comprehensive Python SDK for MatrixOne database operations with vector search, fulltext search, and advanced features"
9
9
  readme = "README_USER.md"
10
10
  license = {text = "Apache-2.0"}