tinybird 0.0.1.dev18__py3-none-any.whl → 0.0.1.dev20__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.
Potentially problematic release.
This version of tinybird might be problematic. Click here for more details.
- tinybird/client.py +24 -4
- tinybird/config.py +1 -1
- tinybird/feedback_manager.py +8 -30
- tinybird/tb/__cli__.py +8 -0
- tinybird/tb/modules/auth.py +1 -1
- tinybird/tb/modules/build.py +26 -80
- tinybird/tb/modules/cicd.py +1 -1
- tinybird/tb/modules/cli.py +11 -837
- tinybird/tb/modules/common.py +1 -55
- tinybird/tb/modules/connection.py +1 -1
- tinybird/tb/modules/create.py +18 -7
- tinybird/tb/modules/datafile/build.py +142 -971
- tinybird/tb/modules/datafile/build_common.py +1 -1
- tinybird/tb/modules/datafile/build_datasource.py +1 -1
- tinybird/tb/modules/datafile/build_pipe.py +1 -1
- tinybird/tb/modules/datafile/common.py +12 -11
- tinybird/tb/modules/datafile/diff.py +1 -1
- tinybird/tb/modules/datafile/fixture.py +1 -1
- tinybird/tb/modules/datafile/format_common.py +0 -7
- tinybird/tb/modules/datafile/format_datasource.py +0 -2
- tinybird/tb/modules/datafile/format_pipe.py +0 -2
- tinybird/tb/modules/datafile/parse_datasource.py +1 -1
- tinybird/tb/modules/datafile/parse_pipe.py +1 -1
- tinybird/tb/modules/datafile/pull.py +1 -1
- tinybird/tb/modules/datasource.py +4 -75
- tinybird/tb/modules/feedback_manager.py +1048 -0
- tinybird/tb/modules/fmt.py +1 -1
- tinybird/tb/modules/job.py +1 -1
- tinybird/tb/modules/llm.py +6 -4
- tinybird/tb/modules/local.py +26 -21
- tinybird/tb/modules/local_common.py +2 -1
- tinybird/tb/modules/login.py +18 -11
- tinybird/tb/modules/mock.py +18 -7
- tinybird/tb/modules/pipe.py +4 -126
- tinybird/tb/modules/{build_shell.py → shell.py} +66 -36
- tinybird/tb/modules/table.py +88 -5
- tinybird/tb/modules/tag.py +2 -2
- tinybird/tb/modules/test.py +45 -29
- tinybird/tb/modules/tinyunit/tinyunit.py +1 -1
- tinybird/tb/modules/token.py +2 -2
- tinybird/tb/modules/watch.py +72 -0
- tinybird/tb/modules/workspace.py +1 -1
- tinybird/tb/modules/workspace_members.py +1 -1
- {tinybird-0.0.1.dev18.dist-info → tinybird-0.0.1.dev20.dist-info}/METADATA +1 -1
- tinybird-0.0.1.dev20.dist-info/RECORD +76 -0
- tinybird-0.0.1.dev18.dist-info/RECORD +0 -73
- {tinybird-0.0.1.dev18.dist-info → tinybird-0.0.1.dev20.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev18.dist-info → tinybird-0.0.1.dev20.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev18.dist-info → tinybird-0.0.1.dev20.dist-info}/top_level.txt +0 -0
tinybird/tb/modules/common.py
CHANGED
|
@@ -37,7 +37,6 @@ from packaging.version import Version
|
|
|
37
37
|
from tinybird.client import (
|
|
38
38
|
AuthException,
|
|
39
39
|
AuthNoTokenException,
|
|
40
|
-
ConnectorNothingToLoad,
|
|
41
40
|
DoesNotExistException,
|
|
42
41
|
JobException,
|
|
43
42
|
OperationCanNotBePerformed,
|
|
@@ -46,8 +45,6 @@ from tinybird.client import (
|
|
|
46
45
|
from tinybird.config import (
|
|
47
46
|
DEFAULT_API_HOST,
|
|
48
47
|
DEFAULT_UI_HOST,
|
|
49
|
-
DEPRECATED_PROJECT_PATHS,
|
|
50
|
-
PROJECT_PATHS,
|
|
51
48
|
SUPPORTED_CONNECTORS,
|
|
52
49
|
VERSION,
|
|
53
50
|
FeatureFlags,
|
|
@@ -60,7 +57,6 @@ from tinybird.tb.modules.table import format_table
|
|
|
60
57
|
if TYPE_CHECKING:
|
|
61
58
|
from tinybird.connectors import Connector
|
|
62
59
|
|
|
63
|
-
from tinybird.feedback_manager import FeedbackManager, warning_message
|
|
64
60
|
from tinybird.syncasync import async_to_sync, sync_to_async
|
|
65
61
|
from tinybird.tb.modules.config import CLIConfig
|
|
66
62
|
from tinybird.tb.modules.exceptions import (
|
|
@@ -70,6 +66,7 @@ from tinybird.tb.modules.exceptions import (
|
|
|
70
66
|
CLIReleaseException,
|
|
71
67
|
CLIWorkspaceException,
|
|
72
68
|
)
|
|
69
|
+
from tinybird.tb.modules.feedback_manager import FeedbackManager, warning_message
|
|
73
70
|
from tinybird.tb.modules.regions import Region
|
|
74
71
|
from tinybird.tb.modules.telemetry import (
|
|
75
72
|
add_telemetry_event,
|
|
@@ -347,29 +344,6 @@ async def _generate_datafile(
|
|
|
347
344
|
return generate_datafile(datafile, filename, data, force, _format=format)
|
|
348
345
|
|
|
349
346
|
|
|
350
|
-
async def folder_init(
|
|
351
|
-
client: TinyB,
|
|
352
|
-
folder: str,
|
|
353
|
-
generate_datasources: Optional[bool] = False,
|
|
354
|
-
force: Optional[bool] = False,
|
|
355
|
-
generate_releases: Optional[bool] = False,
|
|
356
|
-
):
|
|
357
|
-
for x in filter(lambda x: x not in DEPRECATED_PROJECT_PATHS, PROJECT_PATHS):
|
|
358
|
-
try:
|
|
359
|
-
f = Path(folder) / x
|
|
360
|
-
f.mkdir()
|
|
361
|
-
click.echo(FeedbackManager.info_path_created(path=x))
|
|
362
|
-
except FileExistsError:
|
|
363
|
-
if not force:
|
|
364
|
-
click.echo(FeedbackManager.info_path_already_exists(path=x))
|
|
365
|
-
pass
|
|
366
|
-
|
|
367
|
-
if generate_datasources:
|
|
368
|
-
for format in SUPPORTED_FORMATS:
|
|
369
|
-
for path in Path(folder).glob(f"*.{format}"):
|
|
370
|
-
await _generate_datafile(str(path), client, format=format, force=force)
|
|
371
|
-
|
|
372
|
-
|
|
373
347
|
async def configure_connector(connector):
|
|
374
348
|
if connector not in SUPPORTED_CONNECTORS:
|
|
375
349
|
raise CLIException(FeedbackManager.error_invalid_connector(connectors=", ".join(SUPPORTED_CONNECTORS)))
|
|
@@ -876,39 +850,18 @@ def get_format_from_filename_or_url(filename_or_url: str) -> str:
|
|
|
876
850
|
|
|
877
851
|
|
|
878
852
|
async def push_data(
|
|
879
|
-
ctx: Context,
|
|
880
853
|
client: TinyB,
|
|
881
854
|
datasource_name: str,
|
|
882
855
|
url,
|
|
883
|
-
connector: Optional[str],
|
|
884
|
-
sql: Optional[str],
|
|
885
856
|
mode: str = "append",
|
|
886
857
|
sql_condition: Optional[str] = None,
|
|
887
858
|
replace_options=None,
|
|
888
|
-
ignore_empty: bool = False,
|
|
889
859
|
concurrency: int = 1,
|
|
890
860
|
silent: bool = False,
|
|
891
861
|
):
|
|
892
862
|
if url and type(url) is tuple:
|
|
893
863
|
url = url[0]
|
|
894
864
|
|
|
895
|
-
if connector and sql:
|
|
896
|
-
load_connector_config(ctx, connector, False, check_uninstalled=False)
|
|
897
|
-
if connector not in ctx.obj:
|
|
898
|
-
raise CLIException(FeedbackManager.error_connector_not_configured(connector=connector))
|
|
899
|
-
else:
|
|
900
|
-
_connector: "Connector" = ctx.obj[connector]
|
|
901
|
-
if not silent:
|
|
902
|
-
click.echo(FeedbackManager.info_starting_export_process(connector=connector))
|
|
903
|
-
try:
|
|
904
|
-
url = _connector.export_to_gcs(sql, datasource_name, mode)
|
|
905
|
-
except ConnectorNothingToLoad as e:
|
|
906
|
-
if ignore_empty:
|
|
907
|
-
click.echo(str(e))
|
|
908
|
-
return
|
|
909
|
-
else:
|
|
910
|
-
raise e
|
|
911
|
-
|
|
912
865
|
def cb(res):
|
|
913
866
|
if cb.First: # type: ignore[attr-defined]
|
|
914
867
|
blocks_to_process = len([x for x in res["block_log"] if x["status"] == "idle"])
|
|
@@ -1008,13 +961,6 @@ async def push_data(
|
|
|
1008
961
|
|
|
1009
962
|
click.echo(FeedbackManager.success_progress_blocks())
|
|
1010
963
|
|
|
1011
|
-
finally:
|
|
1012
|
-
try:
|
|
1013
|
-
for url in urls:
|
|
1014
|
-
_connector.clean(urlparse(url).path.split("/")[-1])
|
|
1015
|
-
except Exception:
|
|
1016
|
-
pass
|
|
1017
|
-
|
|
1018
964
|
|
|
1019
965
|
async def sync_data(ctx, datasource_name: str, yes: bool):
|
|
1020
966
|
client: TinyB = ctx.obj["client"]
|
|
@@ -13,7 +13,6 @@ import click
|
|
|
13
13
|
from click import Context
|
|
14
14
|
|
|
15
15
|
from tinybird.client import DoesNotExistException, TinyB
|
|
16
|
-
from tinybird.feedback_manager import FeedbackManager
|
|
17
16
|
from tinybird.tb.modules.cli import cli
|
|
18
17
|
from tinybird.tb.modules.common import (
|
|
19
18
|
ConnectionReplacements,
|
|
@@ -34,6 +33,7 @@ from tinybird.tb.modules.common import (
|
|
|
34
33
|
validate_string_connector_param,
|
|
35
34
|
)
|
|
36
35
|
from tinybird.tb.modules.exceptions import CLIConnectionException
|
|
36
|
+
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
37
37
|
from tinybird.tb.modules.telemetry import is_ci_environment
|
|
38
38
|
|
|
39
39
|
DATA_CONNECTOR_SETTINGS: Dict[DataConnectorType, List[str]] = {
|
tinybird/tb/modules/create.py
CHANGED
|
@@ -7,13 +7,13 @@ import click
|
|
|
7
7
|
import requests
|
|
8
8
|
|
|
9
9
|
from tinybird.client import TinyB
|
|
10
|
-
from tinybird.feedback_manager import FeedbackManager
|
|
11
10
|
from tinybird.tb.modules.cicd import init_cicd
|
|
12
11
|
from tinybird.tb.modules.cli import cli
|
|
13
12
|
from tinybird.tb.modules.common import _generate_datafile, check_user_token, coro, generate_datafile
|
|
14
13
|
from tinybird.tb.modules.config import CLIConfig
|
|
15
14
|
from tinybird.tb.modules.datafile.fixture import build_fixture_name, persist_fixture
|
|
16
15
|
from tinybird.tb.modules.exceptions import CLIException
|
|
16
|
+
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
17
17
|
from tinybird.tb.modules.llm import LLM
|
|
18
18
|
|
|
19
19
|
|
|
@@ -60,6 +60,8 @@ async def create(
|
|
|
60
60
|
if prompt:
|
|
61
61
|
user_token = config.get_user_token()
|
|
62
62
|
try:
|
|
63
|
+
if not user_token:
|
|
64
|
+
raise CLIException("No user token found")
|
|
63
65
|
await check_user_token(ctx, token=user_token)
|
|
64
66
|
except Exception:
|
|
65
67
|
click.echo(FeedbackManager.error(message="This action requires authentication. Run 'tb login' first."))
|
|
@@ -91,7 +93,9 @@ async def create(
|
|
|
91
93
|
fixture_content = fetch_gist_content(
|
|
92
94
|
"https://gist.githubusercontent.com/gnzjgo/8e8f66a39d7576ce3a2529bf773334a8/raw/9cab636767990e97d44a141867e5f226e992de8c/users.ndjson"
|
|
93
95
|
)
|
|
94
|
-
fixture_name = build_fixture_name(
|
|
96
|
+
fixture_name = build_fixture_name(
|
|
97
|
+
datasource_path.absolute().as_posix(), ds_name, datasource_path.read_text()
|
|
98
|
+
)
|
|
95
99
|
persist_fixture(fixture_name, fixture_content)
|
|
96
100
|
click.echo(FeedbackManager.info(message=f"✓ /fixtures/{ds_name}"))
|
|
97
101
|
|
|
@@ -108,7 +112,9 @@ async def create(
|
|
|
108
112
|
fixture_content = fetch_gist_content(
|
|
109
113
|
"https://gist.githubusercontent.com/gnzjgo/859ab9439c17e77241d0c14a5a532809/raw/251f2f3f00a968f8759ec4068cebde915256b054/events.ndjson"
|
|
110
114
|
)
|
|
111
|
-
fixture_name = build_fixture_name(
|
|
115
|
+
fixture_name = build_fixture_name(
|
|
116
|
+
datasource_path.absolute().as_posix(), ds_name, datasource_path.read_text()
|
|
117
|
+
)
|
|
112
118
|
persist_fixture(fixture_name, fixture_content)
|
|
113
119
|
click.echo(FeedbackManager.info(message=f"✓ /fixtures/{ds_name}"))
|
|
114
120
|
|
|
@@ -134,7 +140,9 @@ async def create(
|
|
|
134
140
|
ds_name = os.path.basename(data.split(".")[0])
|
|
135
141
|
data_content = Path(data).read_text()
|
|
136
142
|
datasource_path = Path(folder) / "datasources" / f"{ds_name}.datasource"
|
|
137
|
-
fixture_name = build_fixture_name(
|
|
143
|
+
fixture_name = build_fixture_name(
|
|
144
|
+
datasource_path.absolute().as_posix(), ds_name, datasource_path.read_text()
|
|
145
|
+
)
|
|
138
146
|
click.echo(FeedbackManager.info(message=f"✓ /fixtures/{ds_name}"))
|
|
139
147
|
persist_fixture(fixture_name, data_content)
|
|
140
148
|
elif prompt:
|
|
@@ -149,9 +157,12 @@ async def create(
|
|
|
149
157
|
sql = await llm.generate_sql_sample_data(schema=datasource_content, rows=rows, prompt=prompt)
|
|
150
158
|
result = await tb_client.query(f"{sql} FORMAT JSON")
|
|
151
159
|
data = result.get("data", [])
|
|
152
|
-
fixture_name = build_fixture_name(
|
|
153
|
-
|
|
154
|
-
|
|
160
|
+
fixture_name = build_fixture_name(
|
|
161
|
+
datasource_path.absolute().as_posix(), datasource_name, datasource_content
|
|
162
|
+
)
|
|
163
|
+
if data:
|
|
164
|
+
persist_fixture(fixture_name, data)
|
|
165
|
+
click.echo(FeedbackManager.info(message=f"✓ /fixtures/{datasource_name}"))
|
|
155
166
|
|
|
156
167
|
click.echo(FeedbackManager.success(message="✓ Done!\n"))
|
|
157
168
|
except Exception as e:
|