tinybird 4.6.3__tar.gz → 4.6.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.
- {tinybird-4.6.3 → tinybird-4.6.4}/PKG-INFO +6 -1
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/sql_toolset.py +5 -2
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/__cli__.py +2 -2
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/client.py +20 -4
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datasource.py +73 -4
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/feedback_manager.py +5 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird.egg-info/PKG-INFO +6 -1
- {tinybird-4.6.3 → tinybird-4.6.4}/setup.cfg +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/__cli__.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/check_pypi.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/client.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/config.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/context.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/datafile/common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/datatypes.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/feedback_manager.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/git_settings.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/iterating/__init__.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/iterating/data_branch_modes.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/prompts.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/service_datasources.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/sql.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/sql_template.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/syncasync.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/cli.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/config.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/branch.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/build.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/build_common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/config.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/connection_dynamodb.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/connection_kafka.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/connection_s3.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/create.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/format_connection.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/deployment_common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/fmt.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/info.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/job.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/job_common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/local.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/local_logs.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/login.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/login_common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/logs.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/open.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/preview.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/project.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/project_commands.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/py_project.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/query_output.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/secret_common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/sink.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/table.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/test.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/test_common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/token.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/ts_project.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird/tornado_template.py +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird.egg-info/SOURCES.txt +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-4.6.3 → tinybird-4.6.4}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: tinybird
|
|
3
|
-
Version: 4.6.
|
|
3
|
+
Version: 4.6.4
|
|
4
4
|
Summary: Tinybird Command Line Tool
|
|
5
5
|
Home-page: https://www.tinybird.co/docs/forward/commands
|
|
6
6
|
Author: Tinybird
|
|
@@ -52,6 +52,11 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
|
|
|
52
52
|
Changelog
|
|
53
53
|
----------
|
|
54
54
|
|
|
55
|
+
4.6.4
|
|
56
|
+
*******
|
|
57
|
+
|
|
58
|
+
- `Added` ``tb datasource delete`` now accepts ``--lightweight-delete``, ``--partition`` and ``--projection-mode``, backed by the new ``POST /v1/datasources/{name}/delete`` endpoint that uses ClickHouse's lightweight ``DELETE FROM`` instead of the heavy ``ALTER TABLE ... DELETE`` mutation. Lightweight delete is synchronous by default and returns the affected row count plus a partition-level mutation block; pass ``--no-wait`` to enqueue a ``LightweightDeleteJob`` and receive the v0-compatible job envelope.
|
|
59
|
+
|
|
55
60
|
4.6.2
|
|
56
61
|
*******
|
|
57
62
|
|
|
@@ -158,7 +158,7 @@ def has_unoptimized_join(sql: str, left_table: Optional[Union[Tuple[str, str], T
|
|
|
158
158
|
raise UnoptimizedJoinException(sql)
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
def format_where_for_mutation_command(where_clause: str) -> str:
|
|
161
|
+
def format_where_for_mutation_command(where_clause: str, lightweight: bool = False) -> str:
|
|
162
162
|
"""
|
|
163
163
|
>>> format_where_for_mutation_command("numnights = 99")
|
|
164
164
|
'DELETE WHERE numnights = 99'
|
|
@@ -170,11 +170,14 @@ def format_where_for_mutation_command(where_clause: str) -> str:
|
|
|
170
170
|
"DELETE WHERE reservationid = \\\\'\\\\\\\\\\\\'foo\\\\'"
|
|
171
171
|
>>> format_where_for_mutation_command("reservationid = '\\\\'foo'")
|
|
172
172
|
"DELETE WHERE reservationid = \\\\'\\\\\\\\\\\\'foo\\\\'"
|
|
173
|
+
>>> format_where_for_mutation_command("number < 3", lightweight=True)
|
|
174
|
+
'UPDATE _row_exists = 0 WHERE number < 3'
|
|
173
175
|
"""
|
|
174
176
|
formatted_condition = chquery.format(f"""SELECT {where_clause}""").split("SELECT ")[1]
|
|
175
177
|
formatted_condition = formatted_condition.replace("\\", "\\\\").replace("'", "''")
|
|
176
178
|
quoted_condition = chquery.format(f"SELECT '{formatted_condition}'").split("SELECT ")[1]
|
|
177
|
-
|
|
179
|
+
prefix = "UPDATE _row_exists = 0 WHERE" if lightweight else "DELETE WHERE"
|
|
180
|
+
return f"{prefix} {quoted_condition[1:-1]}"
|
|
178
181
|
|
|
179
182
|
|
|
180
183
|
# Functions that take table/dictionary names as string literal arguments.
|
|
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
|
|
|
4
4
|
__url__ = 'https://www.tinybird.co/docs/forward/commands'
|
|
5
5
|
__author__ = 'Tinybird'
|
|
6
6
|
__author_email__ = 'support@tinybird.co'
|
|
7
|
-
__version__ = '4.6.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '4.6.4'
|
|
8
|
+
__revision__ = 'cad29af'
|
|
@@ -468,10 +468,26 @@ class TinyB:
|
|
|
468
468
|
"""Start Kafka ingestion for a datasource in a forward branch."""
|
|
469
469
|
return self._req(f"/v0/datasources/{datasource_name}/start", method="POST", data="")
|
|
470
470
|
|
|
471
|
-
def datasource_delete_rows(
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
471
|
+
def datasource_delete_rows(
|
|
472
|
+
self,
|
|
473
|
+
datasource_name: str,
|
|
474
|
+
delete_condition: str,
|
|
475
|
+
dry_run: bool = False,
|
|
476
|
+
lightweight: bool = False,
|
|
477
|
+
wait: bool = True,
|
|
478
|
+
partition: Optional[str] = None,
|
|
479
|
+
projection_mode: Optional[str] = None,
|
|
480
|
+
):
|
|
481
|
+
params: Dict[str, Any] = {"delete_condition": delete_condition}
|
|
482
|
+
if lightweight:
|
|
483
|
+
params["wait"] = "true" if wait else "false"
|
|
484
|
+
if partition:
|
|
485
|
+
params["partition"] = partition
|
|
486
|
+
if projection_mode:
|
|
487
|
+
params["projection_mode"] = projection_mode
|
|
488
|
+
return self._req(f"/v1/datasources/{datasource_name}/delete", method="POST", data=params)
|
|
489
|
+
elif dry_run:
|
|
490
|
+
params["dry_run"] = "true"
|
|
475
491
|
return self._req(f"/v0/datasources/{datasource_name}/delete", method="POST", data=params)
|
|
476
492
|
|
|
477
493
|
def datasource_dependencies(
|
|
@@ -596,19 +596,66 @@ def datasource_start(ctx: Context, datasource_name: str) -> None:
|
|
|
596
596
|
@click.argument("datasource_name")
|
|
597
597
|
@click.option("--sql-condition", default=None, help="SQL WHERE condition to remove rows", hidden=True, required=True)
|
|
598
598
|
@click.option("--yes", is_flag=True, default=False, help="Do not ask for confirmation")
|
|
599
|
-
@click.option(
|
|
599
|
+
@click.option(
|
|
600
|
+
"--wait/--no-wait",
|
|
601
|
+
default=None,
|
|
602
|
+
help="Wait for the delete to finish. Defaults to true with --lightweight-delete (sync request), "
|
|
603
|
+
"false otherwise (returns a job id).",
|
|
604
|
+
)
|
|
600
605
|
@click.option("--dry-run", is_flag=True, default=False, help="Run the command without deleting anything")
|
|
606
|
+
@click.option(
|
|
607
|
+
"--lightweight-delete",
|
|
608
|
+
"lightweight",
|
|
609
|
+
is_flag=True,
|
|
610
|
+
default=False,
|
|
611
|
+
help="Use ClickHouse lightweight DELETE. Defaults to waiting inline and returning rows_affected; "
|
|
612
|
+
"pass --no-wait to enqueue a job instead. Not compatible with --dry-run.",
|
|
613
|
+
)
|
|
614
|
+
@click.option(
|
|
615
|
+
"--partition",
|
|
616
|
+
default=None,
|
|
617
|
+
help="Restrict the lightweight delete to a single partition expression. Only valid with --lightweight-delete.",
|
|
618
|
+
)
|
|
619
|
+
@click.option(
|
|
620
|
+
"--projection-mode",
|
|
621
|
+
type=click.Choice(["throw", "drop", "rebuild"]),
|
|
622
|
+
default=None,
|
|
623
|
+
help="How ClickHouse should handle table projections when running the lightweight DELETE. "
|
|
624
|
+
"throw: fail the DELETE if the table has any projection defined (ClickHouse default). "
|
|
625
|
+
"drop: drop the affected projections so the DELETE can proceed; they will need to be recreated. "
|
|
626
|
+
"rebuild: rebuild the affected projections after the DELETE finishes. "
|
|
627
|
+
"Only valid with --lightweight-delete.",
|
|
628
|
+
)
|
|
601
629
|
@click.pass_context
|
|
602
|
-
def datasource_delete_rows(
|
|
630
|
+
def datasource_delete_rows(
|
|
631
|
+
ctx, datasource_name, sql_condition, yes, wait, dry_run, lightweight, partition, projection_mode
|
|
632
|
+
):
|
|
603
633
|
"""
|
|
604
634
|
Delete rows from a datasource
|
|
605
635
|
|
|
606
636
|
- Delete rows with SQL condition: `tb datasource delete [datasource_name] --sql-condition "country='ES'"`
|
|
607
637
|
|
|
608
638
|
- Delete rows with SQL condition and wait for the job to finish: `tb datasource delete [datasource_name] --sql-condition "country='ES'" --wait`
|
|
639
|
+
|
|
640
|
+
- Use ClickHouse lightweight DELETE (synchronous, no job): `tb datasource delete [datasource_name] --sql-condition "country='ES'" --lightweight-delete`
|
|
641
|
+
|
|
642
|
+
- Use ClickHouse lightweight DELETE and return immediately with a job id: `tb datasource delete [datasource_name] --sql-condition "country='ES'" --lightweight-delete --no-wait`
|
|
609
643
|
"""
|
|
610
644
|
|
|
611
645
|
client: TinyB = ctx.ensure_object(dict)["client"]
|
|
646
|
+
if lightweight and dry_run:
|
|
647
|
+
raise CLIDatasourceException(
|
|
648
|
+
FeedbackManager.error_exception(error="--lightweight-delete is not compatible with --dry-run")
|
|
649
|
+
)
|
|
650
|
+
if (partition or projection_mode) and not lightweight:
|
|
651
|
+
raise CLIDatasourceException(
|
|
652
|
+
FeedbackManager.error_exception(error="--partition and --projection-mode require --lightweight-delete")
|
|
653
|
+
)
|
|
654
|
+
# Lightweight delete is sync by default (the endpoint blocks and returns
|
|
655
|
+
# rows_affected); the classic /v0/ delete is async by default (returns a
|
|
656
|
+
# job id). The tri-state --wait/--no-wait lets users override either.
|
|
657
|
+
if wait is None:
|
|
658
|
+
wait = lightweight
|
|
612
659
|
if (
|
|
613
660
|
dry_run
|
|
614
661
|
or yes
|
|
@@ -619,7 +666,15 @@ def datasource_delete_rows(ctx, datasource_name, sql_condition, yes, wait, dry_r
|
|
|
619
666
|
)
|
|
620
667
|
):
|
|
621
668
|
try:
|
|
622
|
-
res = client.datasource_delete_rows(
|
|
669
|
+
res = client.datasource_delete_rows(
|
|
670
|
+
datasource_name,
|
|
671
|
+
sql_condition,
|
|
672
|
+
dry_run,
|
|
673
|
+
lightweight=lightweight,
|
|
674
|
+
wait=wait,
|
|
675
|
+
partition=partition,
|
|
676
|
+
projection_mode=projection_mode,
|
|
677
|
+
)
|
|
623
678
|
if dry_run:
|
|
624
679
|
click.echo(
|
|
625
680
|
FeedbackManager.success_dry_run_delete_rows_datasource(
|
|
@@ -627,10 +682,24 @@ def datasource_delete_rows(ctx, datasource_name, sql_condition, yes, wait, dry_r
|
|
|
627
682
|
)
|
|
628
683
|
)
|
|
629
684
|
return
|
|
685
|
+
# Lightweight sync path returns rows_affected directly, no job involved.
|
|
686
|
+
if lightweight and wait:
|
|
687
|
+
mutation = res.get("mutation") or {}
|
|
688
|
+
click.echo(
|
|
689
|
+
FeedbackManager.success_lightweight_delete_rows_datasource(
|
|
690
|
+
datasource=datasource_name,
|
|
691
|
+
delete_condition=sql_condition,
|
|
692
|
+
rows_affected=res.get("rows_affected", 0),
|
|
693
|
+
partitions_scanned=mutation.get("partitions_scanned", 0),
|
|
694
|
+
partitions_done=mutation.get("partitions_done", 0),
|
|
695
|
+
partitions_in_progress=mutation.get("partitions_in_progress", 0),
|
|
696
|
+
)
|
|
697
|
+
)
|
|
698
|
+
return
|
|
630
699
|
job_id = res["job_id"]
|
|
631
700
|
job_url = res["job_url"]
|
|
632
701
|
click.echo(FeedbackManager.info_datasource_delete_rows_job_url(url=job_url))
|
|
633
|
-
if wait:
|
|
702
|
+
if wait and not lightweight:
|
|
634
703
|
progress_symbols = ["-", "\\", "|", "/"]
|
|
635
704
|
progress_str = "Waiting for the job to finish"
|
|
636
705
|
# TODO: Use click.echo instead of print and see if the behavior is the same
|
|
@@ -1071,6 +1071,11 @@ STEP 3: ADD KEY TO SERVICE ACCOUNT
|
|
|
1071
1071
|
success_delete_rows_datasource = success_message(
|
|
1072
1072
|
"** Data Source '{datasource}' rows deleted matching condition \"{delete_condition}\""
|
|
1073
1073
|
)
|
|
1074
|
+
success_lightweight_delete_rows_datasource = success_message(
|
|
1075
|
+
"** Data Source '{datasource}' rows deleted matching condition \"{delete_condition}\""
|
|
1076
|
+
"\n Rows affected: {rows_affected}"
|
|
1077
|
+
"\n Partitions scanned: {partitions_scanned} (done: {partitions_done}, in progress: {partitions_in_progress})"
|
|
1078
|
+
)
|
|
1074
1079
|
success_dry_run_delete_rows_datasource = success_message(
|
|
1075
1080
|
"** [DRY RUN] Data Source '{datasource}' rows '{rows}' matching condition \"{delete_condition}\" to be deleted"
|
|
1076
1081
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: tinybird
|
|
3
|
-
Version: 4.6.
|
|
3
|
+
Version: 4.6.4
|
|
4
4
|
Summary: Tinybird Command Line Tool
|
|
5
5
|
Home-page: https://www.tinybird.co/docs/forward/commands
|
|
6
6
|
Author: Tinybird
|
|
@@ -52,6 +52,11 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
|
|
|
52
52
|
Changelog
|
|
53
53
|
----------
|
|
54
54
|
|
|
55
|
+
4.6.4
|
|
56
|
+
*******
|
|
57
|
+
|
|
58
|
+
- `Added` ``tb datasource delete`` now accepts ``--lightweight-delete``, ``--partition`` and ``--projection-mode``, backed by the new ``POST /v1/datasources/{name}/delete`` endpoint that uses ClickHouse's lightweight ``DELETE FROM`` instead of the heavy ``ALTER TABLE ... DELETE`` mutation. Lightweight delete is synchronous by default and returns the affected row count plus a partition-level mutation block; pass ``--no-wait`` to enqueue a ``LightweightDeleteJob`` and receive the v0-compatible job envelope.
|
|
59
|
+
|
|
55
60
|
4.6.2
|
|
56
61
|
*******
|
|
57
62
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|