tinybird 4.5.6__tar.gz → 4.5.6.dev0__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.5.6 → tinybird-4.5.6.dev0}/PKG-INFO +1 -5
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/__cli__.py +2 -2
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/cli.py +1 -1
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/deployment.py +0 -148
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/deployment_common.py +8 -92
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird.egg-info/PKG-INFO +1 -5
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/setup.cfg +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/__cli__.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/check_pypi.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/client.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/config.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/context.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/datafile/common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/datatypes.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/feedback_manager.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/git_settings.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/prompts.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/service_datasources.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/sql.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/sql_template.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/sql_toolset.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/syncasync.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/cli.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/client.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/config.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/branch.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/build.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/build_common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/config.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/connection_kafka.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/connection_s3.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/create.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/format_connection.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/datasource.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/feedback_manager.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/fmt.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/info.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/job.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/job_common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/local.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/local_logs.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/login.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/login_common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/logs.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/open.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/preview.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/project.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/project_commands.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/py_project.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/query_output.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/secret_common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/sink.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/table.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/test.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/test_common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/token.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/ts_project.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird/tornado_template.py +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird.egg-info/SOURCES.txt +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-4.5.6 → tinybird-4.5.6.dev0}/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.5.6
|
|
3
|
+
Version: 4.5.6.dev0
|
|
4
4
|
Summary: Tinybird Command Line Tool
|
|
5
5
|
Home-page: https://www.tinybird.co/docs/forward/commands
|
|
6
6
|
Author: Tinybird
|
|
@@ -52,10 +52,6 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
|
|
|
52
52
|
Changelog
|
|
53
53
|
----------
|
|
54
54
|
|
|
55
|
-
4.5.6
|
|
56
|
-
*******
|
|
57
|
-
|
|
58
|
-
- `Fixed` Issue when executing command `tb migrate-to-forward`
|
|
59
55
|
|
|
60
56
|
4.5.5
|
|
61
57
|
*******
|
|
@@ -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.5.6'
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '4.5.6.dev0'
|
|
8
|
+
__revision__ = 'a651a4a'
|
|
@@ -63,7 +63,7 @@ DEV_MODE_VALUES = {DEV_MODE_MANUAL, DEV_MODE_LOCAL, DEV_MODE_BRANCH}
|
|
|
63
63
|
DEV_MODE_ROUTED_COMMANDS = {"build", "deploy"}
|
|
64
64
|
SDK_PROJECT_ROUTED_COMMANDS = {"build", "deploy", "preview"}
|
|
65
65
|
TS_PROJECT_ROUTED_COMMANDS = SDK_PROJECT_ROUTED_COMMANDS
|
|
66
|
-
COMMANDS_ALWAYS_CLOUD = {"infra", "branch", "environment", "workspace", "preview"
|
|
66
|
+
COMMANDS_ALWAYS_CLOUD = {"infra", "branch", "environment", "workspace", "preview"}
|
|
67
67
|
PROJECT_TYPE_TYPESCRIPT = "ts-sdk"
|
|
68
68
|
PROJECT_TYPE_PYTHON = "python-sdk"
|
|
69
69
|
PROJECT_TYPE_CLI = "cli"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
-
import os
|
|
4
3
|
from datetime import datetime, timedelta, timezone
|
|
5
4
|
from pathlib import Path
|
|
6
5
|
from typing import Any, Dict, Optional
|
|
@@ -8,17 +7,14 @@ from typing import Any, Dict, Optional
|
|
|
8
7
|
import click
|
|
9
8
|
import requests
|
|
10
9
|
|
|
11
|
-
from tinybird.tb.client import TinyB
|
|
12
10
|
from tinybird.tb.modules.cli import cli
|
|
13
11
|
from tinybird.tb.modules.common import (
|
|
14
12
|
echo_safe_humanfriendly_tables_format_smart_table,
|
|
15
13
|
sys_exit,
|
|
16
14
|
)
|
|
17
|
-
from tinybird.tb.modules.create import persist_tinybird_config
|
|
18
15
|
from tinybird.tb.modules.deployment_common import (
|
|
19
16
|
create_deployment,
|
|
20
17
|
discard_deployment,
|
|
21
|
-
migrate_to_forward_workspace,
|
|
22
18
|
promote_deployment,
|
|
23
19
|
)
|
|
24
20
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
@@ -155,47 +151,6 @@ def api_fetch(url: str, headers: dict, request_from: Optional[str] = None) -> di
|
|
|
155
151
|
return {}
|
|
156
152
|
|
|
157
153
|
|
|
158
|
-
def _get_classic_workspace_branches(client: TinyB, workspace_id: str) -> list[dict[str, Any]]:
|
|
159
|
-
branches: list[dict[str, Any]] = client.user_workspace_branches(version="v0").get("workspaces", [])
|
|
160
|
-
return [branch for branch in branches if str(branch.get("main")) == workspace_id]
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
def _cleanup_classic_migration_blockers(client: TinyB, config: Dict[str, Any]) -> None:
|
|
164
|
-
workspace_id = str(config["id"])
|
|
165
|
-
|
|
166
|
-
try:
|
|
167
|
-
branches = _get_classic_workspace_branches(client, workspace_id)
|
|
168
|
-
if not branches:
|
|
169
|
-
return
|
|
170
|
-
|
|
171
|
-
for branch in branches:
|
|
172
|
-
client.delete_branch(id=str(branch["id"]))
|
|
173
|
-
except Exception as e:
|
|
174
|
-
message = f"Error cleaning up Classic branches or releases before migration: {str(e)}"
|
|
175
|
-
click.echo(FeedbackManager.error(message=message))
|
|
176
|
-
sys_exit("migration_error", message)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def _persist_migrate_to_forward_config(project: Project) -> None:
|
|
180
|
-
root_folder = os.getcwd()
|
|
181
|
-
project_folder = os.path.relpath(project.path.resolve(), root_folder)
|
|
182
|
-
|
|
183
|
-
config_changed, config_created = persist_tinybird_config(
|
|
184
|
-
root_folder=root_folder,
|
|
185
|
-
project_type="cli",
|
|
186
|
-
dev_mode="manual",
|
|
187
|
-
folder=project_folder,
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
if not config_changed:
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
message = "Created tinybird.config.json for the Forward CLI"
|
|
194
|
-
if not config_created:
|
|
195
|
-
message = "Updated tinybird.config.json for the Forward CLI"
|
|
196
|
-
click.echo(FeedbackManager.info(message=message))
|
|
197
|
-
|
|
198
|
-
|
|
199
154
|
@cli.group(name="deployment")
|
|
200
155
|
def deployment_group() -> None:
|
|
201
156
|
"""
|
|
@@ -416,107 +371,6 @@ def deploy(
|
|
|
416
371
|
create_deployment_cmd(ctx, wait, auto, check, allow_destructive_operations, template, verbose)
|
|
417
372
|
|
|
418
373
|
|
|
419
|
-
@cli.command(name="migrate-to-forward")
|
|
420
|
-
@click.option(
|
|
421
|
-
"--allow-destructive-operations/--no-allow-destructive-operations",
|
|
422
|
-
is_flag=True,
|
|
423
|
-
default=False,
|
|
424
|
-
help="Allow destructive operations in deployments (for example replacing a Pipe with a Data Source).",
|
|
425
|
-
)
|
|
426
|
-
@click.pass_context
|
|
427
|
-
def migrate_to_forward(ctx: click.Context, allow_destructive_operations: bool) -> None:
|
|
428
|
-
"""Migrate a Tinybird Classic cloud workspace to Tinybird Forward."""
|
|
429
|
-
client = ctx.ensure_object(dict)["client"]
|
|
430
|
-
project: Project = ctx.ensure_object(dict)["project"]
|
|
431
|
-
config: Dict[str, Any] = ctx.ensure_object(dict)["config"]
|
|
432
|
-
env = ctx.ensure_object(dict)["env"]
|
|
433
|
-
output = ctx.ensure_object(dict)["output"]
|
|
434
|
-
|
|
435
|
-
try:
|
|
436
|
-
client.workspace_info(version="v1")
|
|
437
|
-
message = "This command is unavailable for Tinybird Forward workspaces."
|
|
438
|
-
click.echo(FeedbackManager.error(message=message))
|
|
439
|
-
sys_exit("migration_error", message)
|
|
440
|
-
except Exception:
|
|
441
|
-
pass
|
|
442
|
-
|
|
443
|
-
try:
|
|
444
|
-
client.workspace_info(version="v0")
|
|
445
|
-
except Exception as e:
|
|
446
|
-
message = f"Error checking workspace status: {str(e)}"
|
|
447
|
-
click.echo(FeedbackManager.error(message=message))
|
|
448
|
-
sys_exit("migration_error", message)
|
|
449
|
-
|
|
450
|
-
click.echo(
|
|
451
|
-
FeedbackManager.warning(
|
|
452
|
-
message=(
|
|
453
|
-
"This operation is irreversible: once your workspace is migrated to Tinybird Forward, "
|
|
454
|
-
"you cannot switch it back to Tinybird Classic. It will also run your first Forward deployment."
|
|
455
|
-
)
|
|
456
|
-
)
|
|
457
|
-
)
|
|
458
|
-
|
|
459
|
-
if not click.confirm("Do you want to proceed and run the deployment check now?", default=False):
|
|
460
|
-
click.echo(FeedbackManager.info(message="Migration cancelled."))
|
|
461
|
-
return
|
|
462
|
-
|
|
463
|
-
check_result = create_deployment(
|
|
464
|
-
project,
|
|
465
|
-
client,
|
|
466
|
-
config,
|
|
467
|
-
wait=False,
|
|
468
|
-
auto=False,
|
|
469
|
-
verbose=False,
|
|
470
|
-
check=True,
|
|
471
|
-
allow_destructive_operations=allow_destructive_operations,
|
|
472
|
-
output=output,
|
|
473
|
-
env=env,
|
|
474
|
-
show_migrate_to_forward_hint=False,
|
|
475
|
-
return_check_result=True,
|
|
476
|
-
validate_forward_workspace=False,
|
|
477
|
-
)
|
|
478
|
-
if not check_result:
|
|
479
|
-
message = "Deployment check did not complete. Migration cancelled."
|
|
480
|
-
click.echo(FeedbackManager.error(message=message))
|
|
481
|
-
sys_exit("migration_error", message)
|
|
482
|
-
|
|
483
|
-
if check_result and check_result.get("status") == "no_changes":
|
|
484
|
-
click.echo(
|
|
485
|
-
FeedbackManager.warning(
|
|
486
|
-
message=(
|
|
487
|
-
"No deployment changes were detected. Add this dummy pipe to your workspace and run "
|
|
488
|
-
"`tb migrate-to-forward` again:"
|
|
489
|
-
)
|
|
490
|
-
)
|
|
491
|
-
)
|
|
492
|
-
click.echo("NODE n\nSQL >\n select 'Forward'")
|
|
493
|
-
return
|
|
494
|
-
|
|
495
|
-
if not click.confirm(
|
|
496
|
-
"Do you want to continue with the migration? This will also delete your branches, releases and switch your workspace from Classic to Forward.",
|
|
497
|
-
default=False,
|
|
498
|
-
):
|
|
499
|
-
click.echo(FeedbackManager.info(message="Migration cancelled."))
|
|
500
|
-
return
|
|
501
|
-
|
|
502
|
-
_cleanup_classic_migration_blockers(client, config)
|
|
503
|
-
_persist_migrate_to_forward_config(project)
|
|
504
|
-
migrate_to_forward_workspace(client=client, output=output, dry_run=False)
|
|
505
|
-
create_deployment(
|
|
506
|
-
project,
|
|
507
|
-
client,
|
|
508
|
-
config,
|
|
509
|
-
wait=True,
|
|
510
|
-
auto=True,
|
|
511
|
-
verbose=False,
|
|
512
|
-
check=False,
|
|
513
|
-
allow_destructive_operations=allow_destructive_operations,
|
|
514
|
-
output=output,
|
|
515
|
-
env=env,
|
|
516
|
-
validate_forward_workspace=False,
|
|
517
|
-
)
|
|
518
|
-
|
|
519
|
-
|
|
520
374
|
def create_deployment_cmd(
|
|
521
375
|
ctx: click.Context,
|
|
522
376
|
wait: bool,
|
|
@@ -527,7 +381,6 @@ def create_deployment_cmd(
|
|
|
527
381
|
verbose: bool = False,
|
|
528
382
|
) -> None:
|
|
529
383
|
output = ctx.ensure_object(dict)["output"]
|
|
530
|
-
env = ctx.ensure_object(dict)["env"]
|
|
531
384
|
project: Project = ctx.ensure_object(dict)["project"]
|
|
532
385
|
if template:
|
|
533
386
|
if project.get_project_files():
|
|
@@ -563,7 +416,6 @@ def create_deployment_cmd(
|
|
|
563
416
|
allow_destructive_operations,
|
|
564
417
|
ingest_hint=not is_web_analytics_starter_kit,
|
|
565
418
|
output=output,
|
|
566
|
-
env=env,
|
|
567
419
|
)
|
|
568
420
|
show_web_analytics_starter_kit_hints(client, is_web_analytics_starter_kit)
|
|
569
421
|
|
|
@@ -99,22 +99,6 @@ def api_post(
|
|
|
99
99
|
return {}
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
def _get_migrate_to_forward_error_message(result: dict[str, Any]) -> str:
|
|
103
|
-
error = result.get("error")
|
|
104
|
-
if error:
|
|
105
|
-
return str(error)
|
|
106
|
-
|
|
107
|
-
deployment = result.get("deployment") or {}
|
|
108
|
-
deployment_errors = deployment.get("errors") or []
|
|
109
|
-
error_messages = [
|
|
110
|
-
str(item.get("error")) for item in deployment_errors if isinstance(item, dict) and item.get("error")
|
|
111
|
-
]
|
|
112
|
-
if error_messages:
|
|
113
|
-
return "; ".join(error_messages)
|
|
114
|
-
|
|
115
|
-
return "Migration to Tinybird Forward failed"
|
|
116
|
-
|
|
117
|
-
|
|
118
102
|
def _is_first_deployment_with_seed_live(host: Optional[str], headers: dict) -> bool:
|
|
119
103
|
"""Best-effort check for first real deployment when seed deployment (id=0) is still live."""
|
|
120
104
|
try:
|
|
@@ -150,49 +134,8 @@ def _get_deployment_job(client: TinyB, deployment_id: Optional[Union[str, int]])
|
|
|
150
134
|
return None
|
|
151
135
|
|
|
152
136
|
|
|
153
|
-
def migrate_to_forward_workspace(client: TinyB, output: str = "human", dry_run: bool = False) -> None:
|
|
154
|
-
headers = {"Authorization": f"Bearer {client.token}"}
|
|
155
|
-
params = {"dry_run": dry_run}
|
|
156
|
-
result = api_post(f"{client.host}/v1/migrate-to-forward", headers=headers, params=params)
|
|
157
|
-
|
|
158
|
-
if result.get("result") != "success":
|
|
159
|
-
error_message = _get_migrate_to_forward_error_message(result)
|
|
160
|
-
if output == "json":
|
|
161
|
-
echo_json(result)
|
|
162
|
-
else:
|
|
163
|
-
click.echo(FeedbackManager.error(message=error_message))
|
|
164
|
-
sys_exit("deployment_error", error_message)
|
|
165
|
-
|
|
166
|
-
if dry_run:
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
if output == "json":
|
|
170
|
-
echo_json(result)
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
click.echo(FeedbackManager.success(message="✓ Workspace migrated to Tinybird Forward"))
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
def _should_show_migrate_to_forward_hint(client: TinyB, env: Optional[str]) -> bool:
|
|
177
|
-
if env != "cloud":
|
|
178
|
-
return False
|
|
179
|
-
|
|
180
|
-
try:
|
|
181
|
-
client.workspace_info(version="v1")
|
|
182
|
-
return False
|
|
183
|
-
except Exception:
|
|
184
|
-
pass
|
|
185
|
-
|
|
186
|
-
try:
|
|
187
|
-
workspace_info = client.workspace_info(version="v0")
|
|
188
|
-
except Exception:
|
|
189
|
-
logging.exception("Error reading workspace info while deciding migrate-to-forward hint")
|
|
190
|
-
return False
|
|
191
|
-
|
|
192
|
-
return not workspace_info.get("is_forward", False) and not workspace_info.get("is_branch", False)
|
|
193
|
-
|
|
194
|
-
|
|
195
137
|
# TODO(eclbg): This logic should be in the server, and there should be a dedicated endpoint for promoting a deployment
|
|
138
|
+
# potato
|
|
196
139
|
def promote_deployment(
|
|
197
140
|
host: Optional[str],
|
|
198
141
|
headers: dict,
|
|
@@ -342,12 +285,9 @@ def create_deployment(
|
|
|
342
285
|
check: Optional[bool] = None,
|
|
343
286
|
allow_destructive_operations: Optional[bool] = None,
|
|
344
287
|
ingest_hint: Optional[bool] = True,
|
|
345
|
-
show_migrate_to_forward_hint: bool = True,
|
|
346
288
|
output: Optional[str] = "human",
|
|
347
289
|
env: Optional[str] = "cloud",
|
|
348
|
-
|
|
349
|
-
validate_forward_workspace: bool = True,
|
|
350
|
-
) -> Optional[Dict[str, Any]]:
|
|
290
|
+
) -> None:
|
|
351
291
|
# TODO: This code is duplicated in build_server.py
|
|
352
292
|
# Should be refactored to be shared
|
|
353
293
|
MULTIPART_BOUNDARY_DATA_PROJECT = "data_project://"
|
|
@@ -402,8 +342,6 @@ def create_deployment(
|
|
|
402
342
|
params["auto_promote"] = "true"
|
|
403
343
|
if allow_destructive_operations:
|
|
404
344
|
params["allow_destructive_operations"] = "true"
|
|
405
|
-
if not validate_forward_workspace:
|
|
406
|
-
params["validate_forward_workspace"] = "false"
|
|
407
345
|
|
|
408
346
|
deployment_request_sent = True
|
|
409
347
|
result = api_post(
|
|
@@ -450,27 +388,10 @@ def create_deployment(
|
|
|
450
388
|
|
|
451
389
|
status = result.get("result")
|
|
452
390
|
if check:
|
|
453
|
-
if status
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
if (
|
|
458
|
-
output == "human"
|
|
459
|
-
and show_migrate_to_forward_hint
|
|
460
|
-
and _should_show_migrate_to_forward_hint(client, env)
|
|
461
|
-
):
|
|
462
|
-
click.echo(
|
|
463
|
-
FeedbackManager.info(
|
|
464
|
-
message=(
|
|
465
|
-
"You can now migrate this Tinybird Classic workspace to Forward "
|
|
466
|
-
"with `tb migrate-to-forward`."
|
|
467
|
-
)
|
|
468
|
-
)
|
|
469
|
-
)
|
|
470
|
-
|
|
471
|
-
if return_check_result:
|
|
472
|
-
return {"status": status, "deployment": deployment}
|
|
473
|
-
|
|
391
|
+
if status == "success":
|
|
392
|
+
click.echo(FeedbackManager.success(message="\n✓ Deployment is valid"))
|
|
393
|
+
sys.exit(0)
|
|
394
|
+
elif status == "no_changes":
|
|
474
395
|
sys.exit(0)
|
|
475
396
|
|
|
476
397
|
click.echo(FeedbackManager.error(message="\n✗ Deployment is not valid"))
|
|
@@ -518,10 +439,7 @@ def create_deployment(
|
|
|
518
439
|
except Exception as e:
|
|
519
440
|
click.echo(FeedbackManager.error_exception(error=e))
|
|
520
441
|
|
|
521
|
-
if check:
|
|
522
|
-
sys_exit("deployment_error", "Deployment check failed")
|
|
523
|
-
|
|
524
|
-
if not deployment:
|
|
442
|
+
if not deployment and not check:
|
|
525
443
|
sys_exit("deployment_error", "Deployment failed")
|
|
526
444
|
except KeyboardInterrupt:
|
|
527
445
|
if deployment_request_sent and not check:
|
|
@@ -550,7 +468,7 @@ def create_deployment(
|
|
|
550
468
|
if not deployment:
|
|
551
469
|
click.echo(FeedbackManager.error(message="Error parsing deployment from response"))
|
|
552
470
|
sys_exit("deployment_error", "Error parsing deployment from response")
|
|
553
|
-
return
|
|
471
|
+
return
|
|
554
472
|
|
|
555
473
|
status = deployment.get("status")
|
|
556
474
|
errors = deployment.get("errors")
|
|
@@ -645,8 +563,6 @@ def create_deployment(
|
|
|
645
563
|
if output == "json" and deployment:
|
|
646
564
|
echo_json(deployment, 8)
|
|
647
565
|
|
|
648
|
-
return None
|
|
649
|
-
|
|
650
566
|
|
|
651
567
|
def _build_data_movement_message(kind: str, source_mv_name: Optional[str]) -> str:
|
|
652
568
|
if kind == "backfill_with_mv_queries":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: tinybird
|
|
3
|
-
Version: 4.5.6
|
|
3
|
+
Version: 4.5.6.dev0
|
|
4
4
|
Summary: Tinybird Command Line Tool
|
|
5
5
|
Home-page: https://www.tinybird.co/docs/forward/commands
|
|
6
6
|
Author: Tinybird
|
|
@@ -52,10 +52,6 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
|
|
|
52
52
|
Changelog
|
|
53
53
|
----------
|
|
54
54
|
|
|
55
|
-
4.5.6
|
|
56
|
-
*******
|
|
57
|
-
|
|
58
|
-
- `Fixed` Issue when executing command `tb migrate-to-forward`
|
|
59
55
|
|
|
60
56
|
4.5.5
|
|
61
57
|
*******
|
|
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
|