tinybird 0.0.1.dev324__tar.gz → 0.0.1.dev326__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-0.0.1.dev324 → tinybird-0.0.1.dev326}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/sql_template.py +1 -1
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/client.py +84 -2
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/connection.py +102 -191
- tinybird-0.0.1.dev326/tinybird/tb/modules/connection_kafka.py +345 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/copy.py +2 -14
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/create.py +6 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datasource.py +37 -95
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/deployment_common.py +52 -21
- tinybird-0.0.1.dev326/tinybird/tb/modules/job_common.py +15 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/project.py +14 -5
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/sink.py +2 -14
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird.egg-info/SOURCES.txt +2 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/setup.cfg +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/datafile/common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/prompts.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/service_datasources.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/__init__.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/agent.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/animations.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/banner.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/command_agent.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/compactor.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/explore_agent.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/file_agent.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/memory.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/mock_agent.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/models.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/prompts.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/testing_agent.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/__init__.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/analyze.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/append.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/build.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/datafile.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/deploy.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/deploy_check.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/diff_resource.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/execute_query.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/file.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/get_endpoint_stats.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/get_openapi_definition.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/mock.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/plan.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/request_endpoint.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/run_command.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/secret.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/tools/test.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/agent/utils.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/branch.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/build_common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/dev_server.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/info.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/local_logs.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/login_common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/mock_common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/secret_common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/test.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/test_common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev324 → tinybird-0.0.1.dev326}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -1841,7 +1841,7 @@ def get_var_names_and_types(t, node_id=None):
|
|
|
1841
1841
|
raise SQLTemplateException(e)
|
|
1842
1842
|
|
|
1843
1843
|
|
|
1844
|
-
@lru_cache(maxsize=
|
|
1844
|
+
@lru_cache(maxsize=512)
|
|
1845
1845
|
def get_var_names_and_types_cached(t: Template):
|
|
1846
1846
|
return get_var_names_and_types(t)
|
|
1847
1847
|
|
|
@@ -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__ = '0.0.1.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev326'
|
|
8
|
+
__revision__ = '4414501'
|
|
@@ -996,10 +996,92 @@ class TinyB:
|
|
|
996
996
|
data=json.dumps(connection_params),
|
|
997
997
|
)
|
|
998
998
|
|
|
999
|
-
def kafka_list_topics(self, connection_id: str, timeout=
|
|
1000
|
-
resp = self._req(
|
|
999
|
+
def kafka_list_topics(self, connection_id: str, timeout=10, retries=3):
|
|
1000
|
+
resp = self._req(
|
|
1001
|
+
f"/v0/connectors/{connection_id}/preview?preview_activity=false",
|
|
1002
|
+
timeout=timeout,
|
|
1003
|
+
retries=retries,
|
|
1004
|
+
)
|
|
1001
1005
|
return [x["topic"] for x in resp["preview"]]
|
|
1002
1006
|
|
|
1007
|
+
def kafka_preview_group(self, connection_id: str, topic: str, group_id: str, timeout=30):
|
|
1008
|
+
params = {
|
|
1009
|
+
"log": "previewGroup",
|
|
1010
|
+
"kafka_group_id": group_id,
|
|
1011
|
+
"kafka_topic": topic,
|
|
1012
|
+
"preview_group": "true",
|
|
1013
|
+
}
|
|
1014
|
+
return self._req(f"/v0/connectors/{connection_id}/preview?{urlencode(params)}", method="GET", timeout=timeout)
|
|
1015
|
+
|
|
1016
|
+
def kafka_preview_topic(self, connection_id: str, topic: str, group_id: str, timeout: int = 30) -> Dict[str, Any]:
|
|
1017
|
+
"""Preview a Kafka topic and return structured preview data.
|
|
1018
|
+
|
|
1019
|
+
Args:
|
|
1020
|
+
connection_id: The ID of the Kafka connection
|
|
1021
|
+
topic: The Kafka topic name to preview
|
|
1022
|
+
group_id: The Kafka consumer group ID
|
|
1023
|
+
timeout: Request timeout in seconds
|
|
1024
|
+
|
|
1025
|
+
Returns:
|
|
1026
|
+
A dictionary containing:
|
|
1027
|
+
- analysis: Dictionary with columns information
|
|
1028
|
+
- preview: Dictionary with data and meta arrays
|
|
1029
|
+
- earliestTimestamp: The earliest message timestamp (if available)
|
|
1030
|
+
"""
|
|
1031
|
+
params = {
|
|
1032
|
+
"max_records": "12",
|
|
1033
|
+
"preview_activity": "true",
|
|
1034
|
+
"preview_earliest_timestamp": "true",
|
|
1035
|
+
"kafka_topic": topic,
|
|
1036
|
+
"kafka_group_id": group_id,
|
|
1037
|
+
"log": "previewTopic",
|
|
1038
|
+
}
|
|
1039
|
+
response = self._req(
|
|
1040
|
+
f"/v0/connectors/{connection_id}/preview?{urlencode(params)}", method="GET", timeout=timeout
|
|
1041
|
+
)
|
|
1042
|
+
|
|
1043
|
+
if not response:
|
|
1044
|
+
return {
|
|
1045
|
+
"analysis": {"columns": []},
|
|
1046
|
+
"preview": {"data": [], "meta": []},
|
|
1047
|
+
"earliestTimestamp": "",
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
# Extract preview data (similar to TypeScript previewKafkaTopic)
|
|
1051
|
+
preview_data = response.get("preview", [])
|
|
1052
|
+
if not preview_data:
|
|
1053
|
+
return {
|
|
1054
|
+
"analysis": {"columns": []},
|
|
1055
|
+
"preview": {"data": [], "meta": []},
|
|
1056
|
+
"earliestTimestamp": "",
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
topic_preview = preview_data[0]
|
|
1060
|
+
analysis = topic_preview.get("analysis", {})
|
|
1061
|
+
deserialized = topic_preview.get("deserialized", {})
|
|
1062
|
+
|
|
1063
|
+
# Extract columns from analysis
|
|
1064
|
+
columns = analysis.get("columns", []) if analysis else []
|
|
1065
|
+
|
|
1066
|
+
# Extract data and meta from deserialized
|
|
1067
|
+
base_data = deserialized.get("data", []) if deserialized else []
|
|
1068
|
+
base_meta = deserialized.get("meta", []) if deserialized else []
|
|
1069
|
+
|
|
1070
|
+
# Extract earliest timestamp
|
|
1071
|
+
earliest = response.get("earliest", [])
|
|
1072
|
+
earliest_timestamp = earliest[0].get("timestamp", "") if earliest else ""
|
|
1073
|
+
|
|
1074
|
+
return {
|
|
1075
|
+
"analysis": {
|
|
1076
|
+
"columns": columns,
|
|
1077
|
+
},
|
|
1078
|
+
"preview": {
|
|
1079
|
+
"data": base_data,
|
|
1080
|
+
"meta": base_meta,
|
|
1081
|
+
},
|
|
1082
|
+
"earliestTimestamp": earliest_timestamp,
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1003
1085
|
def get_gcp_service_account_details(self) -> Dict[str, Any]:
|
|
1004
1086
|
return self._req("/v0/datasources-bigquery-credentials")
|
|
1005
1087
|
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
# - But please, **do not** interleave utility functions and command definitions.
|
|
5
5
|
|
|
6
6
|
import uuid
|
|
7
|
-
from typing import Any, Dict, List, Optional
|
|
7
|
+
from typing import Any, Dict, List, Optional
|
|
8
8
|
|
|
9
9
|
import click
|
|
10
10
|
from click import Context
|
|
11
|
-
from confluent_kafka.admin import AdminClient
|
|
12
11
|
|
|
13
12
|
from tinybird.tb.client import TinyB
|
|
13
|
+
from tinybird.tb.modules.build_common import process as build_project
|
|
14
14
|
from tinybird.tb.modules.cli import cli
|
|
15
15
|
from tinybird.tb.modules.common import (
|
|
16
16
|
DataConnectorType,
|
|
@@ -18,21 +18,15 @@ from tinybird.tb.modules.common import (
|
|
|
18
18
|
echo_safe_humanfriendly_tables_format_smart_table,
|
|
19
19
|
get_gcs_connection_name,
|
|
20
20
|
get_gcs_svc_account_creds,
|
|
21
|
-
get_kafka_connection_name,
|
|
22
21
|
get_s3_connection_name,
|
|
23
22
|
production_aws_iamrole_only,
|
|
24
23
|
run_aws_iamrole_connection_flow,
|
|
25
24
|
run_gcp_svc_account_connection_flow,
|
|
26
|
-
validate_kafka_auto_offset_reset,
|
|
27
|
-
validate_kafka_bootstrap_servers,
|
|
28
|
-
validate_kafka_key,
|
|
29
|
-
validate_kafka_schema_registry_url,
|
|
30
|
-
validate_kafka_secret,
|
|
31
25
|
)
|
|
26
|
+
from tinybird.tb.modules.connection_kafka import connection_create_kafka, echo_kafka_data, select_group_id, select_topic
|
|
32
27
|
from tinybird.tb.modules.create import (
|
|
33
28
|
generate_aws_iamrole_connection_file_with_secret,
|
|
34
29
|
generate_gcs_connection_file_with_secrets,
|
|
35
|
-
generate_kafka_connection_with_secrets,
|
|
36
30
|
)
|
|
37
31
|
from tinybird.tb.modules.exceptions import CLIConnectionException
|
|
38
32
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
@@ -315,198 +309,115 @@ def connection_create_gcs(ctx: Context) -> None:
|
|
|
315
309
|
)
|
|
316
310
|
|
|
317
311
|
|
|
318
|
-
@connection_create.command(name="kafka",
|
|
312
|
+
@connection_create.command(name="kafka", help="Create a Kafka connection.")
|
|
313
|
+
@click.option("--connection-name", default=None, help="The name of the connection to identify it in Tinybird")
|
|
314
|
+
@click.option("--bootstrap-servers", default=None, help="Kafka Bootstrap Server in form mykafka.mycloud.com:9092")
|
|
315
|
+
@click.option("--key", default=None, help="Key/User")
|
|
316
|
+
@click.option("--secret", default=None, help="Secret/Password")
|
|
317
|
+
@click.option(
|
|
318
|
+
"--auto-offset-reset", default=None, help="Offset reset, can be 'latest' or 'earliest'. Defaults to 'latest'."
|
|
319
|
+
)
|
|
320
|
+
@click.option("--schema-registry-url", default=None, help="Avro Confluent Schema Registry URL")
|
|
321
|
+
@click.option(
|
|
322
|
+
"--sasl-mechanism",
|
|
323
|
+
default="PLAIN",
|
|
324
|
+
help="Authentication method for connection-based protocols. Defaults to 'PLAIN'",
|
|
325
|
+
)
|
|
326
|
+
@click.option(
|
|
327
|
+
"--security-protocol",
|
|
328
|
+
default="SASL_SSL",
|
|
329
|
+
help="Security protocol for connection-based protocols. Defaults to 'SASL_SSL'",
|
|
330
|
+
)
|
|
331
|
+
@click.option("--ssl-ca-pem", default=None, help="Path or content of the CA Certificate file in PEM format")
|
|
319
332
|
@click.pass_context
|
|
320
|
-
def connection_create_kafka_cmd(
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
+
def connection_create_kafka_cmd(
|
|
334
|
+
ctx: Context,
|
|
335
|
+
connection_name: Optional[str],
|
|
336
|
+
bootstrap_servers: Optional[str],
|
|
337
|
+
key: Optional[str],
|
|
338
|
+
secret: Optional[str],
|
|
339
|
+
auto_offset_reset: Optional[str],
|
|
340
|
+
schema_registry_url: Optional[str],
|
|
341
|
+
sasl_mechanism: Optional[str],
|
|
342
|
+
security_protocol: Optional[str],
|
|
343
|
+
ssl_ca_pem: Optional[str],
|
|
344
|
+
) -> None:
|
|
345
|
+
env: str = ctx.ensure_object(dict)["env"]
|
|
333
346
|
project: Project = ctx.ensure_object(dict)["project"]
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
FeedbackManager.
|
|
338
|
-
|
|
339
|
-
)
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
bootstrap_servers
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
tb_secret_bootstrap_servers: Optional[str] = None
|
|
353
|
-
tb_secret_key: Optional[str] = None
|
|
354
|
-
tb_secret_secret: Optional[str] = None
|
|
355
|
-
|
|
356
|
-
if secret_required:
|
|
357
|
-
tb_secret_bootstrap_servers = str(click.prompt(FeedbackManager.highlight(message=" ? Secret name")))
|
|
358
|
-
try:
|
|
359
|
-
save_secret_to_env_file(project=project, name=tb_secret_bootstrap_servers, value=bootstrap_servers)
|
|
360
|
-
except Exception as e:
|
|
361
|
-
raise CLIConnectionException(FeedbackManager.error(message=str(e)))
|
|
362
|
-
|
|
363
|
-
key = click.prompt(FeedbackManager.highlight(message="? Kafka key"))
|
|
364
|
-
|
|
365
|
-
validate_kafka_key(key)
|
|
366
|
-
|
|
367
|
-
secret_required = click.confirm(
|
|
368
|
-
FeedbackManager.highlight(message=" ? Do you want to store the Kafka key in a .env.local file? [Y/n]"),
|
|
369
|
-
default=True,
|
|
370
|
-
show_default=False,
|
|
371
|
-
)
|
|
372
|
-
|
|
373
|
-
if secret_required:
|
|
374
|
-
tb_secret_key = str(click.prompt(FeedbackManager.highlight(message=" ? Secret name")))
|
|
375
|
-
try:
|
|
376
|
-
save_secret_to_env_file(project=project, name=tb_secret_key, value=key)
|
|
377
|
-
except Exception as e:
|
|
378
|
-
raise CLIConnectionException(FeedbackManager.error(message=str(e)))
|
|
379
|
-
|
|
380
|
-
secret = click.prompt(FeedbackManager.highlight(message="? Kafka secret"), hide_input=True)
|
|
381
|
-
|
|
382
|
-
validate_kafka_secret(secret)
|
|
383
|
-
|
|
384
|
-
secret_required = click.confirm(
|
|
385
|
-
FeedbackManager.highlight(message=" ? Do you want to store the Kafka secret in a .env.local file? [Y/n]"),
|
|
386
|
-
default=True,
|
|
387
|
-
show_default=False,
|
|
388
|
-
)
|
|
389
|
-
|
|
390
|
-
if secret_required:
|
|
391
|
-
tb_secret_secret = str(click.prompt(FeedbackManager.highlight(message=" ? Secret name")))
|
|
392
|
-
try:
|
|
393
|
-
save_secret_to_env_file(project=project, name=tb_secret_secret, value=secret)
|
|
394
|
-
except Exception as e:
|
|
395
|
-
raise CLIConnectionException(FeedbackManager.error(message=str(e)))
|
|
396
|
-
|
|
397
|
-
security_protocol_options = ["SASL_SSL", "PLAINTEXT"]
|
|
398
|
-
security_protocol = click.prompt(
|
|
399
|
-
FeedbackManager.highlight(message="? Security Protocol (SASL_SSL, PLAINTEXT) [SASL_SSL]"),
|
|
400
|
-
type=click.Choice(security_protocol_options),
|
|
401
|
-
show_default=False,
|
|
402
|
-
show_choices=False,
|
|
403
|
-
default="SASL_SSL",
|
|
404
|
-
)
|
|
405
|
-
|
|
406
|
-
sasl_mechanism_options = ["PLAIN", "SCRAM-SHA-256", "SCRAM-SHA-512"]
|
|
407
|
-
sasl_mechanism = click.prompt(
|
|
408
|
-
FeedbackManager.highlight(message="? SASL Mechanism (PLAIN, SCRAM-SHA-256, SCRAM-SHA-512) [PLAIN]"),
|
|
409
|
-
type=click.Choice(sasl_mechanism_options),
|
|
410
|
-
show_default=False,
|
|
411
|
-
show_choices=False,
|
|
412
|
-
default="PLAIN",
|
|
347
|
+
client: TinyB = ctx.ensure_object(dict)["client"]
|
|
348
|
+
config: Dict[str, Any] = ctx.ensure_object(dict)["config"]
|
|
349
|
+
if env == "local":
|
|
350
|
+
click.echo(FeedbackManager.gray(message="» Building project..."))
|
|
351
|
+
build_project(project=project, tb_client=client, watch=False, config=config, silent=True)
|
|
352
|
+
click.echo(FeedbackManager.success(message="✓ Build completed"))
|
|
353
|
+
|
|
354
|
+
result = connection_create_kafka(
|
|
355
|
+
ctx,
|
|
356
|
+
connection_name=connection_name,
|
|
357
|
+
bootstrap_servers=bootstrap_servers,
|
|
358
|
+
key=key,
|
|
359
|
+
secret=secret,
|
|
360
|
+
auto_offset_reset=auto_offset_reset,
|
|
361
|
+
schema_registry_url=schema_registry_url,
|
|
362
|
+
sasl_mechanism=sasl_mechanism,
|
|
363
|
+
security_protocol=security_protocol,
|
|
364
|
+
ssl_ca_pem=ssl_ca_pem,
|
|
413
365
|
)
|
|
414
366
|
|
|
415
|
-
|
|
416
|
-
click.confirm(
|
|
417
|
-
FeedbackManager.highlight(
|
|
418
|
-
message="? Would you like to create this connection in the cloud environment as well? [Y/n]"
|
|
419
|
-
),
|
|
367
|
+
if not result["error"]:
|
|
368
|
+
yes = click.confirm(
|
|
369
|
+
FeedbackManager.highlight(message="? Would you like to preview data from the connection?"),
|
|
420
370
|
default=True,
|
|
421
371
|
show_default=False,
|
|
422
372
|
)
|
|
423
|
-
if
|
|
424
|
-
|
|
425
|
-
|
|
373
|
+
if yes:
|
|
374
|
+
connection_data(ctx, connection_name=result["name"])
|
|
375
|
+
else:
|
|
376
|
+
click.echo(FeedbackManager.gray(message="Skipping data preview."))
|
|
426
377
|
|
|
427
|
-
if create_in_cloud:
|
|
428
|
-
click.echo(FeedbackManager.gray(message="» Creating Secrets in cloud environment..."))
|
|
429
|
-
prod_config = obj["config"]
|
|
430
|
-
host = prod_config["host"]
|
|
431
|
-
token = prod_config["token"]
|
|
432
|
-
prod_client = TinyB(
|
|
433
|
-
token=token,
|
|
434
|
-
host=host,
|
|
435
|
-
staging=False,
|
|
436
|
-
)
|
|
437
|
-
if tb_secret_bootstrap_servers:
|
|
438
|
-
prod_client.create_secret(name=tb_secret_bootstrap_servers, value=bootstrap_servers)
|
|
439
|
-
if tb_secret_key:
|
|
440
|
-
prod_client.create_secret(name=tb_secret_key, value=key)
|
|
441
|
-
if tb_secret_secret:
|
|
442
|
-
prod_client.create_secret(name=tb_secret_secret, value=secret)
|
|
443
|
-
click.echo(FeedbackManager.success(message="✓ Secrets created!"))
|
|
444
|
-
|
|
445
|
-
schema_registry_url = click.prompt(
|
|
446
|
-
FeedbackManager.highlight(message="? Schema Registry URL (optional)"),
|
|
447
|
-
default="",
|
|
448
|
-
show_default=False,
|
|
449
|
-
)
|
|
450
|
-
if schema_registry_url:
|
|
451
|
-
validate_kafka_schema_registry_url(schema_registry_url)
|
|
452
|
-
|
|
453
|
-
auto_offset_reset_options = ["latest", "earliest"]
|
|
454
|
-
auto_offset_reset = click.prompt(
|
|
455
|
-
FeedbackManager.highlight(message="? Auto offset reset (latest, earliest) [latest]"),
|
|
456
|
-
type=click.Choice(auto_offset_reset_options),
|
|
457
|
-
default="latest",
|
|
458
|
-
show_default=False,
|
|
459
|
-
show_choices=False,
|
|
460
|
-
)
|
|
461
|
-
validate_kafka_auto_offset_reset(auto_offset_reset)
|
|
462
|
-
click.echo(FeedbackManager.gray(message="» Validating connection..."))
|
|
463
378
|
|
|
464
|
-
|
|
379
|
+
@connection.command(name="data", help="Preview data from an existing connection.")
|
|
380
|
+
@click.argument("connection_name", type=str)
|
|
381
|
+
@click.option("--kafka-topic", type=str, help="The Kafka topic to preview")
|
|
382
|
+
@click.option("--kafka-group-id", type=str, help="The Kafka group ID to use for preview")
|
|
383
|
+
@click.pass_context
|
|
384
|
+
def connection_data_cmd(
|
|
385
|
+
ctx: Context,
|
|
386
|
+
connection_name: str,
|
|
387
|
+
kafka_topic: Optional[str] = None,
|
|
388
|
+
kafka_group_id: Optional[str] = None,
|
|
389
|
+
) -> None:
|
|
390
|
+
connection_data(ctx, connection_name, kafka_topic, kafka_group_id)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def connection_data(
|
|
394
|
+
ctx: Context,
|
|
395
|
+
connection_name: str,
|
|
396
|
+
kafka_topic: Optional[str] = None,
|
|
397
|
+
kafka_group_id: Optional[str] = None,
|
|
398
|
+
) -> None:
|
|
399
|
+
project: Project = ctx.ensure_object(dict)["project"]
|
|
400
|
+
client: TinyB = ctx.ensure_object(dict)["client"]
|
|
401
|
+
env: str = ctx.ensure_object(dict)["env"]
|
|
402
|
+
config: Dict[str, Any] = ctx.ensure_object(dict)["config"]
|
|
465
403
|
|
|
466
|
-
if
|
|
467
|
-
|
|
404
|
+
if env == "local":
|
|
405
|
+
click.echo(FeedbackManager.gray(message="» Building project to access the latest connections..."))
|
|
406
|
+
build_project(project=project, tb_client=client, watch=False, config=config, silent=True)
|
|
407
|
+
click.echo(FeedbackManager.success(message="✓ Build completed"))
|
|
468
408
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
bootstrap_servers=bootstrap_servers,
|
|
473
|
-
tb_secret_bootstrap_servers=tb_secret_bootstrap_servers,
|
|
474
|
-
key=key,
|
|
475
|
-
tb_secret_key=tb_secret_key,
|
|
476
|
-
secret=secret,
|
|
477
|
-
tb_secret_secret=tb_secret_secret,
|
|
478
|
-
security_protocol=security_protocol,
|
|
479
|
-
sasl_mechanism=sasl_mechanism,
|
|
480
|
-
folder=project.folder,
|
|
481
|
-
)
|
|
482
|
-
click.echo(FeedbackManager.info_file_created(file=f"connections/{name}.connection"))
|
|
483
|
-
click.echo(FeedbackManager.success(message="✓ Connection created!"))
|
|
484
|
-
return (
|
|
485
|
-
name,
|
|
486
|
-
bootstrap_servers,
|
|
487
|
-
key,
|
|
488
|
-
secret,
|
|
489
|
-
schema_registry_url,
|
|
490
|
-
auto_offset_reset,
|
|
491
|
-
sasl_mechanism,
|
|
492
|
-
security_protocol,
|
|
493
|
-
topics,
|
|
494
|
-
)
|
|
409
|
+
connection = next((c for c in client.connections() if c["name"] == connection_name), None)
|
|
410
|
+
if not connection:
|
|
411
|
+
raise CLIConnectionException(FeedbackManager.error(message=f"Connection {connection_name} not found."))
|
|
495
412
|
|
|
413
|
+
if connection["service"] != DataConnectorType.KAFKA:
|
|
414
|
+
raise CLIConnectionException(
|
|
415
|
+
FeedbackManager.error(
|
|
416
|
+
message=f"{connection['service']} connections are not supported yet for previewing data. Supported connections: kafka"
|
|
417
|
+
)
|
|
418
|
+
)
|
|
496
419
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
"sasl.mechanism": sasl_mechanism,
|
|
502
|
-
"sasl.username": sasl_username,
|
|
503
|
-
"sasl.password": sasl_password,
|
|
504
|
-
"log_level": 0,
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
try:
|
|
508
|
-
client = AdminClient(conf)
|
|
509
|
-
metadata = client.list_topics(timeout=5)
|
|
510
|
-
return list(metadata.topics.keys())
|
|
511
|
-
except Exception:
|
|
512
|
-
return None
|
|
420
|
+
connection_id = connection["id"]
|
|
421
|
+
topic = select_topic(kafka_topic, connection_id, client)
|
|
422
|
+
group_id = select_group_id(kafka_group_id, topic, connection_id, client)
|
|
423
|
+
echo_kafka_data(connection_id, topic, group_id, client)
|