tinybird 5.0.3__tar.gz → 5.0.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-5.0.3 → tinybird-5.0.4}/PKG-INFO +31 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/pyproject.toml +40 -33
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/ch_utils/constants.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/ch_utils/engine.py +5 -9
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/check_pypi.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/client.py +98 -53
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/config.py +3 -40
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/datafile/common.py +50 -74
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/feedback_manager.py +10 -110
- tinybird-5.0.4/tinybird/git_settings.py +63 -0
- tinybird-5.0.4/tinybird/prompts.py +438 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/service_datasources.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/sql.py +7 -5
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/sql_template.py +85 -68
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/sql_template_fmt.py +3 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/sql_toolset.py +8 -8
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/__cli__.py +2 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/client.py +73 -49
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/build.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/build_common.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/cli.py +15 -7
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/common.py +65 -45
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/config.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/connection_kafka.py +6 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/copy.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/build.py +3 -3
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/build_common.py +2 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/build_pipe.py +9 -7
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/diff.py +12 -10
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/format_common.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/format_datasource.py +2 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/format_pipe.py +3 -3
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/pull.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datasource.py +23 -15
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/deployment.py +8 -40
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/deployment_common.py +73 -17
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/deprecations.py +10 -8
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/endpoint.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/feedback_manager.py +15 -7
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/fmt.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/info.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/infra.py +2 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/llm_utils.py +7 -4
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/local.py +4 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/local_common.py +6 -4
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/local_logs.py +5 -5
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/login_common.py +12 -6
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/materialization.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/pipe.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/preview.py +1 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/project.py +0 -46
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/query_output.py +3 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/secret.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/sink.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/table.py +14 -8
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/telemetry.py +7 -3
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/test.py +28 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/test_common.py +62 -6
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/tinyunit/tinyunit.py +6 -6
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/token.py +23 -11
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/watch.py +5 -4
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/branch.py +8 -6
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/cli.py +22 -22
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/common.py +74 -46
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/config.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/connection.py +11 -6
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/datasource.py +46 -28
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/fmt.py +2 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/pipe.py +7 -8
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/tag.py +1 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/telemetry.py +7 -3
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/test.py +5 -5
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +7 -5
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/workspace.py +2 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/workspace_members.py +6 -6
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tornado_template.py +99 -61
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird.egg-info/PKG-INFO +31 -2
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird.egg-info/SOURCES.txt +0 -1
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird.egg-info/requires.txt +2 -1
- tinybird-5.0.3/tinybird/git_settings.py +0 -143
- tinybird-5.0.3/tinybird/prompts.py +0 -913
- tinybird-5.0.3/tinybird/syncasync.py +0 -638
- {tinybird-5.0.3 → tinybird-5.0.4}/setup.cfg +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/__cli__.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/context.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/datatypes.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/iterating/__init__.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/iterating/data_branch_modes.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/cli.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/config.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/branch.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/connection_dynamodb.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/connection_s3.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/create.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/datafile/format_connection.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/job.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/job_common.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/login.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/logs.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/open.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/project_commands.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/py_project.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/secret_common.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/ts_project.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/utils/__init__.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird/utils/bools.py +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-5.0.3 → tinybird-5.0.4}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-5.0.3 → tinybird-5.0.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: 5.0.
|
|
3
|
+
Version: 5.0.4
|
|
4
4
|
Summary: Tinybird Command Line Tool
|
|
5
5
|
Home-page: https://www.tinybird.co/docs/forward/commands
|
|
6
6
|
Author: Tinybird
|
|
@@ -8,6 +8,7 @@ Author-email: support@tinybird.co
|
|
|
8
8
|
Requires-Python: >=3.11, <3.14
|
|
9
9
|
Description-Content-Type: text/x-rst
|
|
10
10
|
Requires-Dist: aiofiles==24.1.0
|
|
11
|
+
Requires-Dist: asgiref<4,>=3.9
|
|
11
12
|
Requires-Dist: boto3
|
|
12
13
|
Requires-Dist: certifi>=2026.10.19
|
|
13
14
|
Requires-Dist: click<8.2,>=8.1.6
|
|
@@ -29,7 +30,7 @@ Requires-Dist: shandy-sqlfmt==0.29.0
|
|
|
29
30
|
Requires-Dist: shandy-sqlfmt[jinjafmt]==0.29.0
|
|
30
31
|
Requires-Dist: toposort==1.10
|
|
31
32
|
Requires-Dist: tornado~=6.5.5
|
|
32
|
-
Requires-Dist: urllib3
|
|
33
|
+
Requires-Dist: urllib3~=2.8
|
|
33
34
|
Requires-Dist: watchdog==6.0.0
|
|
34
35
|
Requires-Dist: wheel
|
|
35
36
|
Requires-Dist: packaging<24,>=23.1
|
|
@@ -53,6 +54,34 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
|
|
|
53
54
|
Changelog
|
|
54
55
|
----------
|
|
55
56
|
|
|
57
|
+
5.0.4
|
|
58
|
+
*******
|
|
59
|
+
|
|
60
|
+
- `Changed` ``tb test run`` loads auto-detected fixtures in a stable, name-sorted order so runs are reproducible across platforms.
|
|
61
|
+
- `Added` ``tb test run --fixture DATASOURCE=PATH`` (repeatable) to load extra fixture files in a controlled order, and ``--no-auto-fixtures`` to skip the name-matching auto-load step.
|
|
62
|
+
- `Fixed` ``tb endpoint ls --format json`` prints the endpoints instead of failing with ``echo() got an unexpected keyword argument 'force_output'`` when the global ``--output`` is ``human``.
|
|
63
|
+
- `Fixed` ``tb test run`` skips a test file that is empty or has only comments instead of failing with ``object of type 'NoneType' has no len()``. ``tb test update`` leaves such a file unchanged instead of failing with ``'NoneType' object is not iterable``.
|
|
64
|
+
- `Fixed` ``tb deploy`` stops waiting and reports how to promote manually when the server reports an auto-promotion error.
|
|
65
|
+
- `Fixed` ``tb --branch=NAME deploy`` and ``tb preview`` print ``tb --branch=NAME deployment ...`` in their follow-up hints instead of ``tb --cloud deployment ...``.
|
|
66
|
+
- `Fixed` ``tb deployment promote`` and ``tb deployment discard`` pick the live deployment by its ``live`` flag instead of its position in the list, and fail when no deployment is live.
|
|
67
|
+
- `Changed` Send the client token in the ``Authorization: Bearer`` header instead of adding it to the URL, so retry warnings and request logs do not show it. A ``token`` query parameter given explicitly, such as ``tb endpoint data --token``, takes precedence.
|
|
68
|
+
- `Changed` SQL templates that use ``**`` keyword unpacking log the warning ``Template uses ** keyword unpacking``. This syntax will become invalid.
|
|
69
|
+
- `Changed` Add type annotations to the parameters of the shared datafile parser. No user-facing behavior changes.
|
|
70
|
+
- `Changed` Add type annotations to the parameters of the remaining CLI modules. No user-facing behavior changes.
|
|
71
|
+
- `Changed` Upgrade ``urllib3`` from ``>=1.26.14,<2`` to ``~=2.8``. HTTPS connections to custom hosts and proxies need TLS 1.2 or later and a certificate with a ``subjectAltName``. On Python 3.13, the CA chain must also pass strict X.509 checks.
|
|
72
|
+
- `Fixed` ``tb sql`` queries longer than 4096 characters that contain non-Latin-1 characters (for example ``€``) no longer fail with ``UnicodeEncodeError``.
|
|
73
|
+
- `Fixed` ``tb deploy --template`` rejects template paths outside the cloned repository (absolute paths, ``..`` segments or symlinks) instead of copying local files into the project folder.
|
|
74
|
+
- `Fixed` ``tb token create jwt`` fails when a ``--filter`` or ``--fixed-params`` lands, by position, on a scope that does not accept it, instead of creating the token without that restriction.
|
|
75
|
+
- `Improved` Workspace listing skips member notification settings.
|
|
76
|
+
- `Improved` Workspace listing skips dedicated-cluster detection.
|
|
77
|
+
- `Fixed` Parsing large multiline datafile blocks avoids quadratic memory allocations.
|
|
78
|
+
- `Fixed` Printing large branch regression test summaries avoids quadratic memory allocations.
|
|
79
|
+
- `Fixed` Parsing large multiline datafile blocks with the legacy parser avoids quadratic memory allocations.
|
|
80
|
+
- `Fixed` The CLI depends on ``asgiref`` (``>=3.9``) instead of bundling an old copy of its ``async_to_sync``/``sync_to_async`` helpers, which avoids ``RuntimeError: Event loop is closed``.
|
|
81
|
+
- `Fixed` ``tb token create static`` keeps ``+``, ``&`` and ``#`` in ``--filter`` when it updates an existing token.
|
|
82
|
+
- `Fixed` Building token filter parameters and SQL schemas avoids quadratic memory allocations.
|
|
83
|
+
- `Changed` Remove unused ``Project`` helpers and the unused ``organization_subscription`` client method.
|
|
84
|
+
|
|
56
85
|
5.0.3
|
|
57
86
|
*******
|
|
58
87
|
|
|
@@ -22,65 +22,67 @@ dependencies = [
|
|
|
22
22
|
"aiofiles==24.1.0",
|
|
23
23
|
"aiohttp~=3.11",
|
|
24
24
|
"anthropic~=1.9",
|
|
25
|
+
"asgiref==3.13.0",
|
|
25
26
|
"async-lru==2.3.0",
|
|
26
27
|
"aws-msk-iam-sasl-signer-python==1.0.2",
|
|
27
|
-
"cachetools~=6.
|
|
28
|
+
"cachetools~=6.2",
|
|
28
29
|
"cffi~=2.0",
|
|
29
30
|
"chardet==4.0.0",
|
|
30
|
-
"ciso8601==2.
|
|
31
|
+
"ciso8601==2.3.3",
|
|
31
32
|
"click~=8.5",
|
|
32
33
|
"clickhouse-cityhash==1.0.2.5",
|
|
33
|
-
"clickhouse-driver==0.2.
|
|
34
|
+
"clickhouse-driver==0.2.10",
|
|
34
35
|
"confluent-kafka[avro,json,schemaregistry]==2.12.2",
|
|
35
36
|
"contextvars==2.4",
|
|
36
37
|
"cramjam==2.11.0",
|
|
37
38
|
"croniter==6.2.2",
|
|
38
39
|
"cryptography~=50.0",
|
|
39
40
|
"datasketch==1.6.5",
|
|
40
|
-
"
|
|
41
|
+
"ddtrace==4.16.1",
|
|
42
|
+
"dnspython==2.9.0",
|
|
41
43
|
"docker==7.1.0",
|
|
42
|
-
"fastavro==1.
|
|
44
|
+
"fastavro==1.13.1",
|
|
43
45
|
"fastmcp==2.12.2",
|
|
44
|
-
"google-cloud-aiplatform~=1.148",
|
|
45
46
|
"google-cloud-compute==1.48.0",
|
|
46
47
|
"google-cloud-scheduler==2.20.0",
|
|
47
48
|
"google-cloud-secret-manager==2.29.0",
|
|
48
49
|
"google-cloud-storage~=3.4",
|
|
49
50
|
"google_api_core~=2.25",
|
|
50
|
-
"googleapis_common_protos==1.
|
|
51
|
-
"grpcio_status==1.
|
|
51
|
+
"googleapis_common_protos==1.70.0",
|
|
52
|
+
"grpcio_status==1.84.0",
|
|
52
53
|
"humanfriendly==10.0",
|
|
53
|
-
"isal==1.
|
|
54
|
+
"isal==1.9.1",
|
|
54
55
|
"jinja2",
|
|
55
56
|
"jsondiff==2.2.1",
|
|
56
57
|
"jsonschema==4.23.0",
|
|
57
58
|
"litellm~=1.97",
|
|
58
59
|
"logfire-api==4.2.0",
|
|
59
|
-
"lru-dict==1.
|
|
60
|
+
"lru-dict==1.4.1",
|
|
60
61
|
"lz4==4.4.5",
|
|
61
62
|
"memray==1.20.0",
|
|
62
63
|
"msgspec==0.21.1",
|
|
63
64
|
"multidict==6.9.1",
|
|
64
65
|
"networkx==3.4.2",
|
|
65
|
-
"numpy==
|
|
66
|
+
"numpy==2.5.4",
|
|
66
67
|
"objgraph==3.6.2",
|
|
67
68
|
"opentelemetry-api~=1.38",
|
|
68
69
|
"opentelemetry-exporter-otlp-proto-http~=1.38",
|
|
70
|
+
"opentelemetry-instrumentation-tornado~=0.66b0",
|
|
69
71
|
"opentelemetry-sdk~=1.38",
|
|
70
72
|
"orb-billing==4.80.1",
|
|
71
|
-
"orjson==3.
|
|
73
|
+
"orjson==3.13.0",
|
|
72
74
|
"packaging~=26.3",
|
|
73
75
|
"passlib==1.7.1",
|
|
74
|
-
"pre-commit==4.
|
|
76
|
+
"pre-commit==4.7.0",
|
|
75
77
|
"prometheus_client==0.26.0",
|
|
76
78
|
"prompt_toolkit==3.0.48",
|
|
77
|
-
"propcache==0.
|
|
78
|
-
"proto_plus==1.
|
|
79
|
-
"protobuf==
|
|
79
|
+
"propcache==0.5.4",
|
|
80
|
+
"proto_plus==1.26.1",
|
|
81
|
+
"protobuf==6.33.6",
|
|
80
82
|
"psutil==7.2.2",
|
|
81
83
|
"psycopg2-binary==2.9.12",
|
|
82
|
-
"py-spy==0.4.
|
|
83
|
-
"pyarrow==
|
|
84
|
+
"py-spy==0.4.3",
|
|
85
|
+
"pyarrow==26.0.0",
|
|
84
86
|
"pycurl==7.45.7",
|
|
85
87
|
"pydantic-ai-slim[anthropic]~=2.0",
|
|
86
88
|
"pydantic-ai-slim[google]~=2.0",
|
|
@@ -88,7 +90,7 @@ dependencies = [
|
|
|
88
90
|
"pydantic~=2.12",
|
|
89
91
|
"pyjwt[crypto]==2.9.0",
|
|
90
92
|
"pympler==1.1",
|
|
91
|
-
"pynacl==1.
|
|
93
|
+
"pynacl==1.6.2",
|
|
92
94
|
"pyperclip==1.9.0",
|
|
93
95
|
"python-dateutil==2.9.0.post0",
|
|
94
96
|
"python-dotenv==1.1.0",
|
|
@@ -96,33 +98,32 @@ dependencies = [
|
|
|
96
98
|
"pyyaml~=6.0",
|
|
97
99
|
"redis[hiredis]==5.3.1",
|
|
98
100
|
"requests~=2.32.5",
|
|
99
|
-
"sentry-sdk==2.
|
|
100
|
-
"setproctitle==1.3.
|
|
101
|
+
"sentry-sdk==2.74.0",
|
|
102
|
+
"setproctitle==1.3.8",
|
|
101
103
|
"shandy-sqlfmt==0.29.0",
|
|
102
104
|
"shandy-sqlfmt[jinjafmt]==0.29.0",
|
|
103
105
|
"sqlparse==0.4.3",
|
|
104
|
-
"starlette==1.0
|
|
106
|
+
"starlette==1.10.0",
|
|
105
107
|
"streaming-form-data==1.20.0",
|
|
106
108
|
"stripe==3.1.0",
|
|
107
109
|
"tabulate==0.8.10",
|
|
108
110
|
"thefuzz==0.22.1",
|
|
109
|
-
"tinybird-
|
|
110
|
-
"tinybird-toolset==2.8.0",
|
|
111
|
+
"tinybird-toolset==2.8.4",
|
|
111
112
|
"toposort==1.10",
|
|
112
113
|
"tornado==6.5.5",
|
|
113
114
|
"urllib3~=2.8",
|
|
114
|
-
"uvicorn[standard]~=0.
|
|
115
|
+
"uvicorn[standard]~=0.54.0",
|
|
115
116
|
"virtualenv==20.21.1",
|
|
116
117
|
"watchdog==6.0.0",
|
|
117
118
|
"wheel==0.37.1",
|
|
118
|
-
"zlib-ng==1.
|
|
119
|
+
"zlib-ng==1.1.0",
|
|
119
120
|
"zstandard==0.25.0",
|
|
120
121
|
]
|
|
121
122
|
|
|
122
123
|
[dependency-groups]
|
|
123
124
|
deploy = [
|
|
124
125
|
"GitPython==3.1.44",
|
|
125
|
-
"ansible==8.
|
|
126
|
+
"ansible==13.8.0",
|
|
126
127
|
"ara==1.6.1",
|
|
127
128
|
"boto3~=1.40",
|
|
128
129
|
"fabric==3.2.2",
|
|
@@ -151,12 +152,14 @@ doc = [
|
|
|
151
152
|
lint = [
|
|
152
153
|
"botocore-stubs~=1.40",
|
|
153
154
|
"celery-types~=0.20.0",
|
|
154
|
-
"flake8~=7.
|
|
155
|
+
"flake8~=7.5",
|
|
155
156
|
"flake8-async~=26.8",
|
|
156
|
-
"mypy==2.
|
|
157
|
-
"ruff==0.17.
|
|
157
|
+
"mypy==2.4.1",
|
|
158
|
+
"ruff==0.17.5",
|
|
158
159
|
"types-Markdown",
|
|
159
160
|
"types-PyYAML",
|
|
161
|
+
"types-aiobotocore-s3~=2.25",
|
|
162
|
+
"types-aiobotocore-sqs~=2.25",
|
|
160
163
|
"types-aiofiles==24.1.0.20241221",
|
|
161
164
|
"types-boto3-lite~=1.40",
|
|
162
165
|
"types-cachetools",
|
|
@@ -188,6 +191,11 @@ test = [
|
|
|
188
191
|
"rangehttpserver==1.4.0",
|
|
189
192
|
"yappi==1.7.6",
|
|
190
193
|
]
|
|
194
|
+
# chdb is a 185 MB wheel: only `tests/dst` needs it. Kept out of `dev` so the jobs that export
|
|
195
|
+
# the default groups do not download it; install it with `uv sync --group dst`.
|
|
196
|
+
dst = [
|
|
197
|
+
"chdb==4.4.0",
|
|
198
|
+
]
|
|
191
199
|
# Synced automatically by plain `uv run`/`uv sync`, no `--group` needed.
|
|
192
200
|
dev = [
|
|
193
201
|
{ include-group = "test" },
|
|
@@ -196,7 +204,7 @@ dev = [
|
|
|
196
204
|
]
|
|
197
205
|
|
|
198
206
|
[project.scripts]
|
|
199
|
-
tinybird_server = "tinybird.
|
|
207
|
+
tinybird_server = "tinybird.server_entrypoint:run"
|
|
200
208
|
tinybird_tool = "tinybird.tinybird_tool.main:cli"
|
|
201
209
|
tb_old = "tinybird.tb_cli:cli"
|
|
202
210
|
tb = "tinybird.tb.cli:cli"
|
|
@@ -218,7 +226,7 @@ include-package-data = true
|
|
|
218
226
|
|
|
219
227
|
[tool.setuptools.packages.find]
|
|
220
228
|
namespaces = false
|
|
221
|
-
include = ["tinybird", "tinybird.*", "tinybird_shared", "tinybird_shared.*"
|
|
229
|
+
include = ["tinybird", "tinybird.*", "tinybird_shared", "tinybird_shared.*"]
|
|
222
230
|
exclude = ["tests*"]
|
|
223
231
|
|
|
224
232
|
[tool.setuptools.package-data]
|
|
@@ -242,5 +250,4 @@ tinybird_shared = [
|
|
|
242
250
|
"gatherer_settings/**/*",
|
|
243
251
|
"clickhouse/**/*",
|
|
244
252
|
"gatherer_backpressure/**/*",
|
|
245
|
-
"data_connector_circuit_breaker/**/*",
|
|
246
253
|
]
|
|
@@ -102,10 +102,6 @@ class TableDetails:
|
|
|
102
102
|
_engine_full = _engine_full.replace(" SETTINGS index_granularity = 8192", "")
|
|
103
103
|
return engine_replicated_to_local(_BACKQUOTED_ENGINE_NAME.sub(r"\1", _engine_full))
|
|
104
104
|
|
|
105
|
-
@property
|
|
106
|
-
def original_engine_full(self) -> Optional[str]:
|
|
107
|
-
return self.details.get("engine_full", None)
|
|
108
|
-
|
|
109
105
|
@property
|
|
110
106
|
def name(self) -> str:
|
|
111
107
|
return self.details.get("name", "")
|
|
@@ -305,10 +301,10 @@ class EngineOption:
|
|
|
305
301
|
name: str,
|
|
306
302
|
sql: str,
|
|
307
303
|
required: Optional[bool] = None,
|
|
308
|
-
default_value=None,
|
|
304
|
+
default_value: Optional[str] = None,
|
|
309
305
|
is_valid: Optional[Callable[[List[Dict[str, Any]], str], Optional[str]]] = None,
|
|
310
306
|
tb_param: Optional[str] = None,
|
|
311
|
-
):
|
|
307
|
+
) -> None:
|
|
312
308
|
self.name = name
|
|
313
309
|
self.sql = sql
|
|
314
310
|
self.required = required
|
|
@@ -322,10 +318,10 @@ class EngineParam:
|
|
|
322
318
|
self,
|
|
323
319
|
name: str,
|
|
324
320
|
required: Optional[bool] = None,
|
|
325
|
-
default_value=None,
|
|
321
|
+
default_value: Optional[str] = None,
|
|
326
322
|
is_valid: Optional[Callable[[List[Dict[str, Any]], str], Optional[str]]] = None,
|
|
327
323
|
tb_param: Optional[str] = None,
|
|
328
|
-
):
|
|
324
|
+
) -> None:
|
|
329
325
|
self.name = name
|
|
330
326
|
self.required = required
|
|
331
327
|
self.default_value = default_value
|
|
@@ -360,7 +356,7 @@ def columns_are_valid(columns: List[Dict[str, Any]], column_names: str) -> str:
|
|
|
360
356
|
return ", ".join(new_column_names)
|
|
361
357
|
|
|
362
358
|
|
|
363
|
-
def sorting_key_is_valid(columns: List[Dict[str, Any]], value: Optional[str]) -> str:
|
|
359
|
+
def sorting_key_is_valid(columns: List[Dict[str, Any]], value: Optional[str]) -> str: # noqa: ARG001
|
|
364
360
|
INVALID_SORTING_KEYS = ["tuple()"]
|
|
365
361
|
|
|
366
362
|
if not value:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
3
|
import requests
|
|
4
|
+
from asgiref.sync import sync_to_async
|
|
4
5
|
|
|
5
6
|
from tinybird.feedback_manager import FeedbackManager
|
|
6
|
-
from tinybird.syncasync import sync_to_async
|
|
7
7
|
from tinybird.tb_cli_modules.common import CLIException, getenv_bool
|
|
8
8
|
|
|
9
9
|
PYPY_URL = "https://pypi.org/pypi/tinybird-cli/json"
|
|
@@ -10,11 +10,11 @@ from urllib.parse import quote, urlencode
|
|
|
10
10
|
import aiofiles
|
|
11
11
|
import requests
|
|
12
12
|
import requests.adapters
|
|
13
|
-
from
|
|
13
|
+
from asgiref.sync import sync_to_async
|
|
14
|
+
from requests import PreparedRequest, Response
|
|
14
15
|
from urllib3 import Retry
|
|
15
16
|
|
|
16
17
|
from tinybird.ch_utils.constants import COPY_ENABLED_TABLE_FUNCTIONS
|
|
17
|
-
from tinybird.syncasync import sync_to_async
|
|
18
18
|
from tinybird.tb_cli_modules.telemetry import add_telemetry_event
|
|
19
19
|
|
|
20
20
|
HOST = "https://api.tinybird.co"
|
|
@@ -51,7 +51,7 @@ class JobException(Exception):
|
|
|
51
51
|
pass
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
def connector_equals(connector, datafile_params):
|
|
54
|
+
def connector_equals(connector: Optional[Dict[str, Any]], datafile_params: Mapping[str, Any]) -> bool:
|
|
55
55
|
if not connector:
|
|
56
56
|
return False
|
|
57
57
|
return connector["name"] == datafile_params["kafka_connection_name"]
|
|
@@ -59,7 +59,7 @@ def connector_equals(connector, datafile_params):
|
|
|
59
59
|
|
|
60
60
|
def parse_error_response(response: Response) -> str:
|
|
61
61
|
try:
|
|
62
|
-
content: Dict = response.json()
|
|
62
|
+
content: Dict[str, Any] = response.json()
|
|
63
63
|
if content.get("error", None):
|
|
64
64
|
error = content["error"]
|
|
65
65
|
if content.get("errors", None):
|
|
@@ -71,6 +71,17 @@ def parse_error_response(response: Response) -> str:
|
|
|
71
71
|
return f"Server error, cannot parse response. {response.content.decode('utf-8')}"
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
class BearerTokenAuth(requests.auth.AuthBase):
|
|
75
|
+
"""Send the token in the `Authorization` header so URLs in logs do not contain it."""
|
|
76
|
+
|
|
77
|
+
def __init__(self, token: str) -> None:
|
|
78
|
+
self.token = token.strip()
|
|
79
|
+
|
|
80
|
+
def __call__(self, request: PreparedRequest) -> PreparedRequest:
|
|
81
|
+
request.headers["Authorization"] = f"Bearer {self.token}"
|
|
82
|
+
return request
|
|
83
|
+
|
|
84
|
+
|
|
74
85
|
class TinyB:
|
|
75
86
|
MAX_GET_LENGTH = 4096
|
|
76
87
|
|
|
@@ -101,18 +112,17 @@ class TinyB:
|
|
|
101
112
|
async def _req_raw(
|
|
102
113
|
self,
|
|
103
114
|
endpoint: str,
|
|
104
|
-
data=None,
|
|
105
|
-
files=None,
|
|
115
|
+
data: Optional[Union[str, bytes, Dict[str, Any]]] = None,
|
|
116
|
+
files: Optional[Dict[str, Any]] = None,
|
|
106
117
|
method: str = "GET",
|
|
107
118
|
retries: int = LIMIT_RETRIES,
|
|
108
119
|
use_token: Optional[str] = None,
|
|
109
|
-
|
|
120
|
+
retry_read_errors: bool = True,
|
|
121
|
+
**kwargs: Any,
|
|
110
122
|
) -> Response:
|
|
111
123
|
url = f"{self.host.strip('/')}/{endpoint.strip('/')}"
|
|
112
124
|
|
|
113
125
|
token_to_use = use_token or self.token
|
|
114
|
-
if token_to_use:
|
|
115
|
-
url += ("&" if "?" in endpoint else "?") + "token=" + token_to_use
|
|
116
126
|
if self.version:
|
|
117
127
|
url += ("&" if "?" in url else "?") + "cli_version=" + quote(self.version)
|
|
118
128
|
if self.semver:
|
|
@@ -123,9 +133,13 @@ class TinyB:
|
|
|
123
133
|
verify_ssl = not self.disable_ssl_checks
|
|
124
134
|
try:
|
|
125
135
|
with requests.Session() as session:
|
|
136
|
+
if token_to_use:
|
|
137
|
+
session.auth = BearerTokenAuth(token_to_use)
|
|
126
138
|
if retries > 0:
|
|
127
139
|
retry = Retry(
|
|
128
140
|
total=retries,
|
|
141
|
+
read=None if retry_read_errors else 0,
|
|
142
|
+
other=None if retry_read_errors else 0,
|
|
129
143
|
status_forcelist=[429] if method in ("POST", "PUT", "DELETE") else [504, 502, 598, 599, 429],
|
|
130
144
|
allowed_methods=frozenset({method}),
|
|
131
145
|
)
|
|
@@ -176,15 +190,18 @@ class TinyB:
|
|
|
176
190
|
async def _req(
|
|
177
191
|
self,
|
|
178
192
|
endpoint: str,
|
|
179
|
-
data=None,
|
|
180
|
-
files=None,
|
|
193
|
+
data: Optional[Union[str, bytes, Dict[str, Any]]] = None,
|
|
194
|
+
files: Optional[Dict[str, Any]] = None,
|
|
181
195
|
method: str = "GET",
|
|
182
196
|
retries: int = LIMIT_RETRIES,
|
|
183
197
|
use_token: Optional[str] = None,
|
|
184
|
-
|
|
185
|
-
|
|
198
|
+
retry_read_errors: bool = True,
|
|
199
|
+
**kwargs: Any,
|
|
200
|
+
) -> Any:
|
|
186
201
|
token_to_use = use_token or self.token
|
|
187
|
-
response = await self._req_raw(
|
|
202
|
+
response = await self._req_raw(
|
|
203
|
+
endpoint, data, files, method, retries, use_token, retry_read_errors=retry_read_errors, **kwargs
|
|
204
|
+
)
|
|
188
205
|
|
|
189
206
|
if response.status_code == 403:
|
|
190
207
|
error = parse_error_response(response)
|
|
@@ -259,7 +276,7 @@ class TinyB:
|
|
|
259
276
|
async def alter_tokens(self, name: str, scopes: List[str]):
|
|
260
277
|
if not scopes:
|
|
261
278
|
return None
|
|
262
|
-
scopes_url: str =
|
|
279
|
+
scopes_url: str = urlencode([("scope", scope) for scope in scopes])
|
|
263
280
|
url = f"/v0/tokens/{name}"
|
|
264
281
|
if len(url + "?" + scopes_url) > TinyB.MAX_GET_LENGTH:
|
|
265
282
|
return await self._req(url, method="PUT", data=scopes_url)
|
|
@@ -380,11 +397,11 @@ class TinyB:
|
|
|
380
397
|
except DoesNotExistException:
|
|
381
398
|
raise Exception(f"Data Source {datasource} not found.")
|
|
382
399
|
|
|
383
|
-
async def datasource_analyze(self, url):
|
|
400
|
+
async def datasource_analyze(self, url: str) -> Any:
|
|
384
401
|
params = {"url": url}
|
|
385
402
|
return await self._req(f"/v0/analyze?{urlencode(params)}", method="POST", data="")
|
|
386
403
|
|
|
387
|
-
async def datasource_analyze_file(self, data):
|
|
404
|
+
async def datasource_analyze_file(self, data: Union[str, bytes, Dict[str, Any]]) -> Any:
|
|
388
405
|
return await self._req("/v0/analyze", method="POST", data=data)
|
|
389
406
|
|
|
390
407
|
async def datasource_create_from_definition(self, parameter_definition: Dict[str, str]):
|
|
@@ -395,7 +412,7 @@ class TinyB:
|
|
|
395
412
|
table_name: str,
|
|
396
413
|
url: str,
|
|
397
414
|
mode: str = "create",
|
|
398
|
-
status_callback=None,
|
|
415
|
+
status_callback: Optional[Callable[..., Any]] = None,
|
|
399
416
|
sql_condition: Optional[str] = None,
|
|
400
417
|
format: str = "csv",
|
|
401
418
|
replace_options: Optional[Set[str]] = None,
|
|
@@ -462,11 +479,11 @@ class TinyB:
|
|
|
462
479
|
datasource_name: str,
|
|
463
480
|
file: Union[str, Path],
|
|
464
481
|
mode: str = "append",
|
|
465
|
-
status_callback=None, # noqa: ARG002 - kept for v0 caller compatibility
|
|
482
|
+
status_callback: Optional[Callable[..., Any]] = None, # noqa: ARG002 - kept for v0 caller compatibility
|
|
466
483
|
sql_condition: Optional[str] = None,
|
|
467
484
|
format: str = "csv",
|
|
468
485
|
replace_options: Optional[Set[str]] = None,
|
|
469
|
-
):
|
|
486
|
+
) -> Dict[str, Any]:
|
|
470
487
|
# V1 returns the import job immediately, so waiting and progress reporting
|
|
471
488
|
# belong to the caller.
|
|
472
489
|
async with aiofiles.open(file, "rb") as content:
|
|
@@ -590,8 +607,22 @@ class TinyB:
|
|
|
590
607
|
payload = {"datasource_a": datasource_a, "datasource_b": datasource_b}
|
|
591
608
|
return await self._req("/v0/datasources/exchange", method="POST", data=payload)
|
|
592
609
|
|
|
593
|
-
async def datasource_events(
|
|
594
|
-
|
|
610
|
+
async def datasource_events(
|
|
611
|
+
self,
|
|
612
|
+
datasource_name: str,
|
|
613
|
+
data: str,
|
|
614
|
+
timeout: Optional[float] = None,
|
|
615
|
+
retries: int = LIMIT_RETRIES,
|
|
616
|
+
retry_read_errors: bool = True,
|
|
617
|
+
) -> Any:
|
|
618
|
+
return await self._req(
|
|
619
|
+
f"/v0/events?name={datasource_name}",
|
|
620
|
+
method="POST",
|
|
621
|
+
data=data,
|
|
622
|
+
retries=retries,
|
|
623
|
+
retry_read_errors=retry_read_errors,
|
|
624
|
+
timeout=timeout,
|
|
625
|
+
)
|
|
595
626
|
|
|
596
627
|
async def analyze_pipe_node(
|
|
597
628
|
self, pipe_name: str, node: Dict[str, Any], dry_run: str = "false", datasource_name: Optional[str] = None
|
|
@@ -608,12 +639,12 @@ class TinyB:
|
|
|
608
639
|
self,
|
|
609
640
|
pipe_name: str,
|
|
610
641
|
node_name: str,
|
|
611
|
-
populate_subset: bool = False,
|
|
642
|
+
populate_subset: Union[bool, float] = False,
|
|
612
643
|
populate_condition: Optional[str] = None,
|
|
613
644
|
truncate: bool = True,
|
|
614
645
|
unlink_on_populate_error: bool = False,
|
|
615
646
|
on_demand_compute: bool = False,
|
|
616
|
-
):
|
|
647
|
+
) -> Dict[str, Any]:
|
|
617
648
|
params: Dict[str, Any] = {
|
|
618
649
|
"truncate": "true" if truncate else "false",
|
|
619
650
|
"unlink_on_populate_error": "true" if unlink_on_populate_error else "false",
|
|
@@ -626,7 +657,13 @@ class TinyB:
|
|
|
626
657
|
params.update({"on_demand_compute": "true"})
|
|
627
658
|
return await self._req(f"/v0/pipes/{pipe_name}/nodes/{node_name}/population?{urlencode(params)}", method="POST")
|
|
628
659
|
|
|
629
|
-
async def pipes(
|
|
660
|
+
async def pipes(
|
|
661
|
+
self,
|
|
662
|
+
branch: Optional[str] = None,
|
|
663
|
+
dependencies: bool = False,
|
|
664
|
+
node_attrs: Optional[str] = None,
|
|
665
|
+
attrs: Optional[str] = None,
|
|
666
|
+
) -> List[Dict[str, Any]]:
|
|
630
667
|
params = {
|
|
631
668
|
"dependencies": "true" if dependencies else "false",
|
|
632
669
|
"attrs": attrs or "",
|
|
@@ -752,7 +789,7 @@ class TinyB:
|
|
|
752
789
|
return await self._req(f"/v0/sql?{urlencode(params)}", data=sql, method="POST")
|
|
753
790
|
return await self._req(f"/v0/sql?q={quote(sql, safe='')}&{urlencode(params)}")
|
|
754
791
|
|
|
755
|
-
async def jobs(self, status=None):
|
|
792
|
+
async def jobs(self, status: Optional[Union[str, List[str]]] = None) -> List[Dict[str, Any]]:
|
|
756
793
|
jobs = (await self._req("/v0/jobs"))["jobs"]
|
|
757
794
|
if status:
|
|
758
795
|
status = [status] if isinstance(status, str) else status
|
|
@@ -766,7 +803,9 @@ class TinyB:
|
|
|
766
803
|
return await self._req(f"/v0/jobs/{job_id}/cancel", method="POST", data=b"")
|
|
767
804
|
|
|
768
805
|
async def user_workspaces(self, version: str = "v0"):
|
|
769
|
-
data = await self._req(
|
|
806
|
+
data = await self._req(
|
|
807
|
+
f"/{version}/user/workspaces/?with_dedicated_cluster=false&with_member_notifications=false&with_environments=false"
|
|
808
|
+
)
|
|
770
809
|
# TODO: this is repeated in local_common.py but I'm avoiding circular imports
|
|
771
810
|
local_port = int(os.getenv("TB_LOCAL_PORT", 80))
|
|
772
811
|
local_host = f"http://localhost:{local_port}"
|
|
@@ -777,20 +816,24 @@ class TinyB:
|
|
|
777
816
|
return {**data, "workspaces": local_workspaces}
|
|
778
817
|
|
|
779
818
|
async def user_workspaces_and_branches(self, version: str = "v0"):
|
|
780
|
-
return await self._req(
|
|
819
|
+
return await self._req(
|
|
820
|
+
f"/{version}/user/workspaces/?with_dedicated_cluster=false&with_member_notifications=false&with_environments=true"
|
|
821
|
+
)
|
|
781
822
|
|
|
782
823
|
async def user_workspaces_with_organization(self, version: str = "v0"):
|
|
783
824
|
return await self._req(
|
|
784
|
-
f"/{version}/user/workspaces/?with_environments=false&with_organization=true&with_members_and_owner=false"
|
|
825
|
+
f"/{version}/user/workspaces/?with_dedicated_cluster=false&with_environments=false&with_organization=true&with_members_and_owner=false"
|
|
785
826
|
)
|
|
786
827
|
|
|
787
828
|
async def user_workspace_branches(self, version: str = "v0"):
|
|
788
|
-
return await self._req(
|
|
829
|
+
return await self._req(
|
|
830
|
+
f"/{version}/user/workspaces/?with_dedicated_cluster=false&with_member_notifications=false&with_environments=true&only_environments=true"
|
|
831
|
+
)
|
|
789
832
|
|
|
790
833
|
async def branches(self):
|
|
791
834
|
return await self._req("/v0/environments")
|
|
792
835
|
|
|
793
|
-
async def releases(self, workspace_id):
|
|
836
|
+
async def releases(self, workspace_id: str) -> Any:
|
|
794
837
|
return await self._req(f"/v0/workspaces/{workspace_id}/releases")
|
|
795
838
|
|
|
796
839
|
async def create_workspace(
|
|
@@ -1004,7 +1047,9 @@ class TinyB:
|
|
|
1004
1047
|
|
|
1005
1048
|
return res
|
|
1006
1049
|
|
|
1007
|
-
async def datasource_kafka_connect(
|
|
1050
|
+
async def datasource_kafka_connect(
|
|
1051
|
+
self, connection_id: str, datasource_name: str, topic: str, group: str, auto_offset_reset: str
|
|
1052
|
+
) -> Any:
|
|
1008
1053
|
return await self._req(
|
|
1009
1054
|
f"/v0/datasources?connector={connection_id}&name={datasource_name}&"
|
|
1010
1055
|
f"kafka_topic={topic}&kafka_group_id={group}&kafka_auto_offset_reset={auto_offset_reset}",
|
|
@@ -1014,22 +1059,22 @@ class TinyB:
|
|
|
1014
1059
|
|
|
1015
1060
|
async def connection_create_kafka(
|
|
1016
1061
|
self,
|
|
1017
|
-
kafka_bootstrap_servers,
|
|
1018
|
-
kafka_key,
|
|
1019
|
-
kafka_secret,
|
|
1020
|
-
kafka_connection_name,
|
|
1021
|
-
kafka_auto_offset_reset=None,
|
|
1022
|
-
kafka_schema_registry_url=None,
|
|
1023
|
-
kafka_sasl_mechanism="PLAIN",
|
|
1024
|
-
kafka_security_protocol="SASL_SSL",
|
|
1025
|
-
kafka_ssl_ca_pem=None,
|
|
1026
|
-
kafka_sasl_oauthbearer_method=None,
|
|
1027
|
-
kafka_sasl_oauthbearer_aws_region=None,
|
|
1028
|
-
kafka_sasl_oauthbearer_aws_role_arn=None,
|
|
1029
|
-
kafka_sasl_oauthbearer_aws_external_id=None,
|
|
1030
|
-
):
|
|
1062
|
+
kafka_bootstrap_servers: str,
|
|
1063
|
+
kafka_key: Optional[str],
|
|
1064
|
+
kafka_secret: Optional[str],
|
|
1065
|
+
kafka_connection_name: str,
|
|
1066
|
+
kafka_auto_offset_reset: Optional[str] = None,
|
|
1067
|
+
kafka_schema_registry_url: Optional[str] = None,
|
|
1068
|
+
kafka_sasl_mechanism: Optional[str] = "PLAIN",
|
|
1069
|
+
kafka_security_protocol: Optional[str] = "SASL_SSL",
|
|
1070
|
+
kafka_ssl_ca_pem: Optional[str] = None,
|
|
1071
|
+
kafka_sasl_oauthbearer_method: Optional[str] = None,
|
|
1072
|
+
kafka_sasl_oauthbearer_aws_region: Optional[str] = None,
|
|
1073
|
+
kafka_sasl_oauthbearer_aws_role_arn: Optional[str] = None,
|
|
1074
|
+
kafka_sasl_oauthbearer_aws_external_id: Optional[str] = None,
|
|
1075
|
+
) -> Any:
|
|
1031
1076
|
is_oauthbearer = kafka_sasl_mechanism == "OAUTHBEARER"
|
|
1032
|
-
params = {
|
|
1077
|
+
params: Dict[str, Optional[str]] = {
|
|
1033
1078
|
"service": "kafka",
|
|
1034
1079
|
"kafka_security_protocol": kafka_security_protocol,
|
|
1035
1080
|
"kafka_sasl_mechanism": kafka_sasl_mechanism,
|
|
@@ -1061,7 +1106,7 @@ class TinyB:
|
|
|
1061
1106
|
data=json.dumps(connection_params),
|
|
1062
1107
|
)
|
|
1063
1108
|
|
|
1064
|
-
async def kafka_list_topics(self, connection_id: str, timeout=5):
|
|
1109
|
+
async def kafka_list_topics(self, connection_id: str, timeout: int = 5) -> List[str]:
|
|
1065
1110
|
resp = await self._req(
|
|
1066
1111
|
f"/v0/connectors/{connection_id}/preview?preview_activity=false",
|
|
1067
1112
|
connect_timeout=timeout,
|
|
@@ -1083,7 +1128,7 @@ class TinyB:
|
|
|
1083
1128
|
async def get_connector_by_id(self, connector_id: Optional[str] = None):
|
|
1084
1129
|
return await self._req(f"/v0/connectors/{connector_id}")
|
|
1085
1130
|
|
|
1086
|
-
async def connector_delete(self, connection_id):
|
|
1131
|
+
async def connector_delete(self, connection_id: str) -> Any:
|
|
1087
1132
|
return await self._req(f"/v0/connectors/{connection_id}", method="DELETE")
|
|
1088
1133
|
|
|
1089
1134
|
async def validate_preview_connection(self, service: str, params: Dict[str, Any]) -> bool:
|
|
@@ -1157,12 +1202,12 @@ class TinyB:
|
|
|
1157
1202
|
return await self._sql_get_used_tables_remote(sql, raising, is_copy)
|
|
1158
1203
|
|
|
1159
1204
|
@staticmethod
|
|
1160
|
-
def _replace_tables_local(q: str, replacements):
|
|
1205
|
+
def _replace_tables_local(q: str, replacements: Dict[Any, str]) -> str:
|
|
1161
1206
|
from tinybird.sql_toolset import replace_tables, replacements_to_tuples
|
|
1162
1207
|
|
|
1163
1208
|
return replace_tables(q, replacements_to_tuples(replacements))
|
|
1164
1209
|
|
|
1165
|
-
async def _replace_tables_remote(self, q: str, replacements):
|
|
1210
|
+
async def _replace_tables_remote(self, q: str, replacements: Dict[Any, str]) -> str:
|
|
1166
1211
|
params = {
|
|
1167
1212
|
"q": q,
|
|
1168
1213
|
"replacements": json.dumps({k[1] if isinstance(k, tuple) else k: v for k, v in replacements.items()}),
|
|
@@ -1170,13 +1215,13 @@ class TinyB:
|
|
|
1170
1215
|
result = await self._req("/v0/sql_replace", data=params, method="POST")
|
|
1171
1216
|
return result["query"]
|
|
1172
1217
|
|
|
1173
|
-
async def replace_tables(self, q: str, replacements):
|
|
1218
|
+
async def replace_tables(self, q: str, replacements: Dict[Any, str]) -> str:
|
|
1174
1219
|
try:
|
|
1175
1220
|
return self._replace_tables_local(q, replacements)
|
|
1176
1221
|
except ModuleNotFoundError:
|
|
1177
1222
|
return await self._replace_tables_remote(q, replacements)
|
|
1178
1223
|
|
|
1179
|
-
async def get_connection(self, **kwargs):
|
|
1224
|
+
async def get_connection(self, **kwargs: Any) -> Optional[Dict[str, Any]]:
|
|
1180
1225
|
result = await self._req("/v0/connectors")
|
|
1181
1226
|
return next((connector for connector in result["connectors"] if connector_equals(connector, kwargs)), None)
|
|
1182
1227
|
|