-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Improve chunk analysis performance (#75)
- Loading branch information
1 parent
32ca128
commit 98ae5bc
Showing
14 changed files
with
429 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ bin | |
lib/ | ||
__pycache__/ | ||
.vscode/ | ||
kaggle_datasets/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,51 @@ | ||
import utils | ||
|
||
def do_tables(shell, arg): | ||
"""List all tables.""" | ||
""" | ||
List all tables in the current database. | ||
Args: | ||
shell (EdgeSQLShell): The shell instance. | ||
arg (str): Additional arguments (not used). | ||
""" | ||
try: | ||
output = shell.edgeSql.list_tables() | ||
except Exception as e: | ||
raise RuntimeError(f"Error: {e}") from e | ||
if not output['success']: | ||
utils.write_output(f"Error: {output['error']}") | ||
return | ||
except RuntimeError as e: | ||
utils.write_output(f"Error: {e}") | ||
return | ||
|
||
if output is not None: | ||
rows = output.get('rows') | ||
columns = output.get('columns') | ||
if rows and columns: | ||
shell.query_output(rows, columns) | ||
else: | ||
utils.write_output("No tables available.") | ||
if output['data'] and len(output['data']['rows']) > 0: | ||
shell.query_output(output['data']['rows'], output['data']['columns']) | ||
else: | ||
utils.write_output("Error listing tables.") | ||
|
||
utils.write_output("No tables available.") | ||
|
||
def do_schema(shell, arg): | ||
""" | ||
Describe table. | ||
Describe the schema of a table. | ||
Args: | ||
shell (EdgeSQLShell): The shell instance. | ||
arg (str): The name of the table to describe. | ||
""" | ||
if not arg: | ||
utils.write_output("Usage: .schema <table_name>") | ||
return | ||
else: | ||
table_name = arg.strip() | ||
|
||
table_name = arg.strip() | ||
|
||
try: | ||
output = shell.edgeSql.describe_table(table_name) | ||
except Exception as e: | ||
raise RuntimeError(f"Error: {e}") from e | ||
if not output['success']: | ||
utils.write_output(f"Error: {output['error']}") | ||
return | ||
except RuntimeError as e: | ||
utils.write_output(f"Error: {e}") | ||
return | ||
|
||
if output is not None: | ||
rows = output.get('rows') | ||
columns = output.get('columns') | ||
if rows and columns: | ||
shell.query_output(rows, columns) | ||
else: | ||
utils.write_output(f"No schema information found for table '{table_name}'.") | ||
if output['data'] and len(output['data']['rows']) > 0: | ||
shell.query_output(output['data']['rows'], output['data']['columns']) | ||
else: | ||
utils.write_output("Error describing table schema.") | ||
utils.write_output(f"No schema information found for table '{table_name}'.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.