matrixone-python-sdk 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl
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.
- matrixone/async_client.py +27 -11
- matrixone/cli_tools.py +1895 -0
- matrixone/client.py +126 -12
- matrixone/connection_hooks.py +54 -5
- matrixone/index_utils.py +4 -2
- {matrixone_python_sdk-0.1.4.dist-info → matrixone_python_sdk-0.1.5.dist-info}/METADATA +347 -6
- {matrixone_python_sdk-0.1.4.dist-info → matrixone_python_sdk-0.1.5.dist-info}/RECORD +12 -10
- {matrixone_python_sdk-0.1.4.dist-info → matrixone_python_sdk-0.1.5.dist-info}/entry_points.txt +1 -1
- tests/online/test_cli_tools_online.py +482 -0
- {matrixone_python_sdk-0.1.4.dist-info → matrixone_python_sdk-0.1.5.dist-info}/WHEEL +0 -0
- {matrixone_python_sdk-0.1.4.dist-info → matrixone_python_sdk-0.1.5.dist-info}/licenses/LICENSE +0 -0
- {matrixone_python_sdk-0.1.4.dist-info → matrixone_python_sdk-0.1.5.dist-info}/top_level.txt +0 -0
matrixone/async_client.py
CHANGED
@@ -2554,39 +2554,49 @@ class AsyncClient(BaseMatrixOneClient):
|
|
2554
2554
|
except Exception as e:
|
2555
2555
|
raise QueryError(f"Failed to get git version: {e}")
|
2556
2556
|
|
2557
|
-
async def get_secondary_index_tables(self, table_name: str) -> List[str]:
|
2557
|
+
async def get_secondary_index_tables(self, table_name: str, database_name: str = None) -> List[str]:
|
2558
2558
|
"""
|
2559
|
-
Get all secondary index table names for a given table
|
2559
|
+
Get all secondary index table names for a given table (async version).
|
2560
|
+
|
2561
|
+
This includes both regular secondary indexes (MULTIPLE type) and UNIQUE indexes.
|
2560
2562
|
|
2561
2563
|
Args:
|
2562
2564
|
table_name: Name of the table to get secondary indexes for
|
2565
|
+
database_name: Name of the database (optional). If None, uses the current database.
|
2563
2566
|
|
2564
2567
|
Returns:
|
2565
|
-
List of secondary index table names
|
2568
|
+
List of secondary index table names (includes both __mo_index_secondary_... and __mo_index_unique_... tables)
|
2566
2569
|
|
2567
2570
|
Examples::
|
2568
2571
|
|
2569
2572
|
>>> async with AsyncClient() as client:
|
2570
2573
|
... await client.connect(host='localhost', port=6001, user='root', password='111', database='test')
|
2574
|
+
... # Use current database
|
2571
2575
|
... index_tables = await client.get_secondary_index_tables('cms_all_content_chunk_info')
|
2576
|
+
... # Or specify database explicitly
|
2577
|
+
... index_tables = await client.get_secondary_index_tables('cms_all_content_chunk_info', 'test')
|
2572
2578
|
... print(index_tables)
|
2573
2579
|
"""
|
2574
2580
|
from .index_utils import build_get_index_tables_sql
|
2575
2581
|
|
2576
|
-
#
|
2577
|
-
|
2582
|
+
# Use provided database_name or get current database from connection params
|
2583
|
+
if database_name is None:
|
2584
|
+
database_name = self._connection_params.get('database') if hasattr(self, '_connection_params') else None
|
2578
2585
|
|
2579
|
-
sql, params = build_get_index_tables_sql(table_name,
|
2586
|
+
sql, params = build_get_index_tables_sql(table_name, database_name)
|
2580
2587
|
result = await self.execute(sql, params)
|
2581
2588
|
return [row[0] for row in result.fetchall()]
|
2582
2589
|
|
2583
|
-
async def get_secondary_index_table_by_name(
|
2590
|
+
async def get_secondary_index_table_by_name(
|
2591
|
+
self, table_name: str, index_name: str, database_name: str = None
|
2592
|
+
) -> Optional[str]:
|
2584
2593
|
"""
|
2585
|
-
Get the physical table name of a secondary index by its index name
|
2594
|
+
Get the physical table name of a secondary index by its index name (async version).
|
2586
2595
|
|
2587
2596
|
Args:
|
2588
2597
|
table_name: Name of the table
|
2589
2598
|
index_name: Name of the secondary index
|
2599
|
+
database_name: Name of the database (optional). If None, uses the current database.
|
2590
2600
|
|
2591
2601
|
Returns:
|
2592
2602
|
Physical table name of the secondary index, or None if not found
|
@@ -2595,15 +2605,21 @@ class AsyncClient(BaseMatrixOneClient):
|
|
2595
2605
|
|
2596
2606
|
>>> async with AsyncClient() as client:
|
2597
2607
|
... await client.connect(host='localhost', port=6001, user='root', password='111', database='test')
|
2608
|
+
... # Use current database
|
2598
2609
|
... index_table = await client.get_secondary_index_table_by_name('cms_all_content_chunk_info', 'cms_id')
|
2610
|
+
... # Or specify database explicitly
|
2611
|
+
... index_table = await client.get_secondary_index_table_by_name(
|
2612
|
+
... 'cms_all_content_chunk_info', 'cms_id', 'test'
|
2613
|
+
... )
|
2599
2614
|
... print(index_table)
|
2600
2615
|
"""
|
2601
2616
|
from .index_utils import build_get_index_table_by_name_sql
|
2602
2617
|
|
2603
|
-
#
|
2604
|
-
|
2618
|
+
# Use provided database_name or get current database from connection params
|
2619
|
+
if database_name is None:
|
2620
|
+
database_name = self._connection_params.get('database') if hasattr(self, '_connection_params') else None
|
2605
2621
|
|
2606
|
-
sql, params = build_get_index_table_by_name_sql(table_name, index_name,
|
2622
|
+
sql, params = build_get_index_table_by_name_sql(table_name, index_name, database_name)
|
2607
2623
|
result = await self.execute(sql, params)
|
2608
2624
|
row = result.fetchone()
|
2609
2625
|
return row[0] if row else None
|