Skip to content

Commit

Permalink
chadmin: additional filter options and configurable timeouts for tabl…
Browse files Browse the repository at this point in the history
…e management commands (#173)
  • Loading branch information
Alex-Burmak authored May 13, 2024
1 parent 24f0d7f commit 6a86ced
Show file tree
Hide file tree
Showing 8 changed files with 489 additions and 244 deletions.
6 changes: 0 additions & 6 deletions ch_tools/chadmin/cli/chs3_backup_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from click import ClickException, argument, group, option, pass_context

from ch_tools.chadmin.internal.backup import unfreeze_backup
from ch_tools.chadmin.internal.table import list_tables
from ch_tools.common import logging
from ch_tools.common.backup import (
CHS3_BACKUPS_DIRECTORY,
Expand Down Expand Up @@ -79,11 +78,6 @@ def delete_chs3_backups(ctx, chs3_backups, *, keep_going=False, dry_run=False):
raise


def get_tables_dict(ctx):
tables = list_tables(ctx, engine="%MergeTree%")
return [{"database": item["database"], "table": item["table"]} for item in tables]


def clear_empty_backup(orphaned_chs3_backup):
backup_directory = os.path.join(CHS3_BACKUPS_DIRECTORY, orphaned_chs3_backup)
try:
Expand Down
2 changes: 1 addition & 1 deletion ch_tools/chadmin/cli/database_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def get_databases(
{% if database %}
WHERE database {{ format_str_match(database) }}
{% else %}
WHERE database NOT IN ('system', 'INFORMATION_SCHEMA')
WHERE database NOT IN ('system', 'information_schema', 'INFORMATION_SCHEMA')
{% endif %}
{% if exclude_database %}
AND database != '{{ exclude_database }}'
Expand Down
4 changes: 2 additions & 2 deletions ch_tools/chadmin/cli/partition_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def get_partitions(
{% if database -%}
WHERE database {{ format_str_match(database) }}
{% else -%}
WHERE database NOT IN ('system', 'INFORMATION_SCHEMA')
WHERE database NOT IN ('system', 'information_schema', 'INFORMATION_SCHEMA')
{% endif -%}
{% if table -%}
AND table {{ format_str_match(table) }}
Expand Down Expand Up @@ -664,7 +664,7 @@ def get_partitions(
{% if database -%}
WHERE database {{ format_str_match(database) }}
{% else -%}
WHERE database NOT IN ('system', 'INFORMATION_SCHEMA')
WHERE database NOT IN ('system', 'information_schema', 'INFORMATION_SCHEMA')
{% endif -%}
{% if active_parts -%}
AND active
Expand Down
Loading

0 comments on commit 6a86ced

Please sign in to comment.