tinybird 0.0.1.dev221__tar.gz → 0.0.1.dev223__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.
Potentially problematic release.
This version of tinybird might be problematic. Click here for more details.
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/ch_utils/constants.py +1 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datasource.py +92 -60
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/feedback_manager.py +5 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/token.py +9 -17
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/setup.cfg +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/datafile/common.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/prompts.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/client.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/create.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/dev_server.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/info.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/sink.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/test.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird.egg-info/SOURCES.txt +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -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.dev223'
|
|
8
|
+
__revision__ = '3fd90ce'
|
|
@@ -687,63 +687,72 @@ async def datasource_create(
|
|
|
687
687
|
FeedbackManager.error(message="`tb datasource create` is not available against Tinybird Cloud.")
|
|
688
688
|
)
|
|
689
689
|
|
|
690
|
-
datasource_types =
|
|
691
|
-
"Blank",
|
|
692
|
-
"Local file",
|
|
693
|
-
"Remote URL",
|
|
694
|
-
"
|
|
695
|
-
"
|
|
696
|
-
"
|
|
697
|
-
|
|
690
|
+
datasource_types = {
|
|
691
|
+
"blank": ("Blank", "Create an empty one"),
|
|
692
|
+
"local_file": ("Local file", "A local file"),
|
|
693
|
+
"remote_url": ("Remote URL", "A remote file"),
|
|
694
|
+
"s3": ("S3", "Files on S3"),
|
|
695
|
+
"gcs": ("GCS", "Files on GCS"),
|
|
696
|
+
"kafka": ("Kafka", "Connect a Kafka topic"),
|
|
697
|
+
"prompt": ("Prompt", "Create a datasource from a prompt"),
|
|
698
|
+
}
|
|
698
699
|
datasource_type: Optional[str] = None
|
|
699
700
|
connection_file: Optional[str] = None
|
|
700
701
|
ds_content = """SCHEMA >
|
|
701
702
|
`data` String `json:$`
|
|
702
703
|
"""
|
|
704
|
+
wizard_mode = True
|
|
703
705
|
if file:
|
|
704
|
-
datasource_type = "
|
|
706
|
+
datasource_type = "local_file"
|
|
707
|
+
wizard_mode = False
|
|
705
708
|
elif url:
|
|
706
|
-
datasource_type = "
|
|
709
|
+
datasource_type = "remote_url"
|
|
710
|
+
wizard_mode = False
|
|
707
711
|
elif blank:
|
|
708
|
-
datasource_type = "
|
|
712
|
+
datasource_type = "blank"
|
|
713
|
+
wizard_mode = False
|
|
709
714
|
elif connection:
|
|
710
715
|
connection_files = project.get_connection_files()
|
|
711
716
|
connection_file = next((f for f in connection_files if f.endswith(f"{connection}.connection")), None)
|
|
712
717
|
if connection_file:
|
|
713
718
|
connection_content = Path(connection_file).read_text()
|
|
714
719
|
if project.is_kafka_connection(connection_content):
|
|
715
|
-
datasource_type = "
|
|
720
|
+
datasource_type = "kafka"
|
|
716
721
|
elif project.is_s3_connection(connection_content):
|
|
717
|
-
datasource_type = "
|
|
722
|
+
datasource_type = "s3"
|
|
718
723
|
elif project.is_gcs_connection(connection_content):
|
|
719
|
-
datasource_type = "
|
|
724
|
+
datasource_type = "gcs"
|
|
720
725
|
elif s3:
|
|
721
|
-
datasource_type = "
|
|
726
|
+
datasource_type = "s3"
|
|
727
|
+
wizard_mode = False
|
|
722
728
|
elif gcs:
|
|
723
|
-
datasource_type = "
|
|
729
|
+
datasource_type = "gcs"
|
|
730
|
+
wizard_mode = False
|
|
724
731
|
elif kafka:
|
|
725
|
-
datasource_type = "
|
|
732
|
+
datasource_type = "kafka"
|
|
733
|
+
wizard_mode = False
|
|
726
734
|
elif prompt:
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
if not user_token:
|
|
730
|
-
raise Exception("This action requires authentication. Run 'tb login' first.")
|
|
731
|
-
project_config = CLIConfig.get_project_config()
|
|
732
|
-
tb_client: TinyB = project_config.get_client(token=config.get("token"), host=config.get("host"))
|
|
733
|
-
await create_resources_from_prompt(tb_client, user_token, prompt, project)
|
|
734
|
-
click.echo(FeedbackManager.success(message="✓ .datasource created!"))
|
|
735
|
-
return
|
|
735
|
+
datasource_type = "prompt"
|
|
736
|
+
wizard_mode = False
|
|
736
737
|
|
|
737
738
|
if datasource_type is None:
|
|
738
|
-
click.echo(
|
|
739
|
+
click.echo(
|
|
740
|
+
FeedbackManager.highlight(
|
|
741
|
+
message="? This command will create the schema (.datasource) for your data. Choose where from:"
|
|
742
|
+
)
|
|
743
|
+
)
|
|
739
744
|
datasource_type_index = -1
|
|
740
745
|
|
|
746
|
+
dt_keys = list(datasource_types.keys())
|
|
741
747
|
while datasource_type_index == -1:
|
|
742
|
-
for index,
|
|
743
|
-
click.echo(
|
|
748
|
+
for index, key in enumerate(dt_keys):
|
|
749
|
+
click.echo(
|
|
750
|
+
f" [{index + 1}] {FeedbackManager.bold(message=datasource_types[key][0])}: {datasource_types[key][1]}"
|
|
751
|
+
)
|
|
752
|
+
click.echo(FeedbackManager.gray(message="\nFiles can be either NDJSON, CSV or Parquet."))
|
|
744
753
|
click.echo(
|
|
745
754
|
FeedbackManager.gray(
|
|
746
|
-
message="Tip: Run `tb datasource create --file | --url | --connection` to skip this step."
|
|
755
|
+
message=("Tip: Run `tb datasource create --file | --url | --connection` to skip this step.")
|
|
747
756
|
)
|
|
748
757
|
)
|
|
749
758
|
datasource_type_index = click.prompt("\nSelect option", default=1)
|
|
@@ -753,7 +762,7 @@ async def datasource_create(
|
|
|
753
762
|
return None
|
|
754
763
|
|
|
755
764
|
try:
|
|
756
|
-
datasource_type =
|
|
765
|
+
datasource_type = dt_keys[int(datasource_type_index) - 1]
|
|
757
766
|
except Exception:
|
|
758
767
|
datasource_type_index = -1
|
|
759
768
|
|
|
@@ -765,19 +774,29 @@ async def datasource_create(
|
|
|
765
774
|
)
|
|
766
775
|
return
|
|
767
776
|
|
|
768
|
-
|
|
777
|
+
if datasource_type == "prompt":
|
|
778
|
+
click.echo(FeedbackManager.gray(message="\n» Creating .datasource file..."))
|
|
779
|
+
user_token = config.get("user_token")
|
|
780
|
+
if not user_token:
|
|
781
|
+
raise Exception("This action requires authentication. Run 'tb login' first.")
|
|
782
|
+
project_config = CLIConfig.get_project_config()
|
|
783
|
+
tb_client: TinyB = project_config.get_client(token=config.get("token"), host=config.get("host"))
|
|
784
|
+
await create_resources_from_prompt(tb_client, user_token, prompt, project)
|
|
785
|
+
click.echo(FeedbackManager.success(message="✓ .datasource created!"))
|
|
786
|
+
return
|
|
787
|
+
|
|
788
|
+
connection_required = datasource_type in ("kafka", "s3", "gcs")
|
|
769
789
|
|
|
770
790
|
if connection_required:
|
|
771
|
-
click.echo(FeedbackManager.gray(message="\n» Creating .
|
|
772
|
-
connection_type = datasource_type.lower()
|
|
791
|
+
click.echo(FeedbackManager.gray(message="\n» Creating .connection file..."))
|
|
773
792
|
|
|
774
793
|
def get_connection_files():
|
|
775
794
|
connection_files = []
|
|
776
|
-
if
|
|
795
|
+
if datasource_type == "kafka":
|
|
777
796
|
connection_files = project.get_kafka_connection_files()
|
|
778
|
-
elif
|
|
797
|
+
elif datasource_type == "s3":
|
|
779
798
|
connection_files = project.get_s3_connection_files()
|
|
780
|
-
elif
|
|
799
|
+
elif datasource_type == "gcs":
|
|
781
800
|
connection_files = project.get_gcs_connection_files()
|
|
782
801
|
return connection_files
|
|
783
802
|
|
|
@@ -785,21 +804,23 @@ async def datasource_create(
|
|
|
785
804
|
connection_name = ""
|
|
786
805
|
topics: List[str] = []
|
|
787
806
|
if len(connection_files) == 0:
|
|
788
|
-
click.echo(FeedbackManager.error(message=f"✗ No {datasource_type} connections found."))
|
|
807
|
+
click.echo(FeedbackManager.error(message=f"✗ No {datasource_types[datasource_type][0]} connections found."))
|
|
789
808
|
if click.confirm(
|
|
790
|
-
FeedbackManager.highlight(
|
|
809
|
+
FeedbackManager.highlight(
|
|
810
|
+
message=f"\n? Do you want to create a {datasource_types[datasource_type][0]} connection? [Y/n]"
|
|
811
|
+
),
|
|
791
812
|
show_default=False,
|
|
792
813
|
default=True,
|
|
793
814
|
):
|
|
794
|
-
if datasource_type != "
|
|
815
|
+
if datasource_type != "kafka":
|
|
795
816
|
click.echo(FeedbackManager.gray(message="\n» Creating .connection file..."))
|
|
796
|
-
default_connection_name = f"{datasource_type
|
|
817
|
+
default_connection_name = f"{datasource_type}_{generate_short_id()}"
|
|
797
818
|
connection_name = click.prompt(
|
|
798
819
|
FeedbackManager.highlight(message=f"? Connection name [{default_connection_name}]"),
|
|
799
820
|
show_default=False,
|
|
800
821
|
default=default_connection_name,
|
|
801
822
|
)
|
|
802
|
-
if datasource_type == "
|
|
823
|
+
if datasource_type == "kafka":
|
|
803
824
|
(
|
|
804
825
|
connection_name,
|
|
805
826
|
bootstrap_servers,
|
|
@@ -811,7 +832,7 @@ async def datasource_create(
|
|
|
811
832
|
security_protocol,
|
|
812
833
|
topics,
|
|
813
834
|
) = await connection_create_kafka(ctx)
|
|
814
|
-
elif datasource_type == "
|
|
835
|
+
elif datasource_type == "s3":
|
|
815
836
|
await generate_aws_iamrole_connection_file_with_secret(
|
|
816
837
|
connection_name,
|
|
817
838
|
service="s3",
|
|
@@ -820,21 +841,19 @@ async def datasource_create(
|
|
|
820
841
|
folder=project.folder,
|
|
821
842
|
with_default_secret=True,
|
|
822
843
|
)
|
|
823
|
-
elif datasource_type == "
|
|
844
|
+
elif datasource_type == "gcs":
|
|
824
845
|
await generate_gcs_connection_file_with_secrets(
|
|
825
846
|
connection_name,
|
|
826
847
|
service="gcs",
|
|
827
848
|
svc_account_creds="GCS_SERVICE_ACCOUNT_CREDENTIALS_JSON",
|
|
828
849
|
folder=project.folder,
|
|
829
850
|
)
|
|
830
|
-
if datasource_type != "
|
|
851
|
+
if datasource_type != "kafka":
|
|
831
852
|
click.echo(FeedbackManager.info(message=f"/connections/{connection_name}.connection"))
|
|
832
853
|
click.echo(FeedbackManager.success(message="✓ .connection created!"))
|
|
833
854
|
connection_files = get_connection_files()
|
|
834
855
|
else:
|
|
835
|
-
click.echo(
|
|
836
|
-
FeedbackManager.info(message=f"→ Run `tb connection create {datasource_type.lower()}` to add one.")
|
|
837
|
-
)
|
|
856
|
+
click.echo(FeedbackManager.info(message=f"→ Run `tb connection create {datasource_type}` to add one."))
|
|
838
857
|
return
|
|
839
858
|
|
|
840
859
|
if not connection_file:
|
|
@@ -842,8 +861,9 @@ async def datasource_create(
|
|
|
842
861
|
connection_path = Path(connection_file)
|
|
843
862
|
connection = connection_path.stem
|
|
844
863
|
|
|
845
|
-
|
|
846
|
-
|
|
864
|
+
click.echo(FeedbackManager.gray(message="\n» Creating .datasource file..."))
|
|
865
|
+
|
|
866
|
+
if datasource_type == "local_file":
|
|
847
867
|
if not file:
|
|
848
868
|
file = click.prompt(FeedbackManager.highlight(message="? Path"))
|
|
849
869
|
if file.startswith("~"):
|
|
@@ -863,8 +883,7 @@ async def datasource_create(
|
|
|
863
883
|
show_default=False,
|
|
864
884
|
)
|
|
865
885
|
|
|
866
|
-
if datasource_type == "
|
|
867
|
-
click.echo(FeedbackManager.gray(message="\n» Creating .datasource file..."))
|
|
886
|
+
if datasource_type == "remote_url":
|
|
868
887
|
if not url:
|
|
869
888
|
url = click.prompt(FeedbackManager.highlight(message="? URL"))
|
|
870
889
|
format = url.split(".")[-1]
|
|
@@ -876,10 +895,7 @@ async def datasource_create(
|
|
|
876
895
|
show_default=False,
|
|
877
896
|
)
|
|
878
897
|
|
|
879
|
-
if datasource_type
|
|
880
|
-
click.echo(FeedbackManager.gray(message="\n» Creating .datasource file..."))
|
|
881
|
-
|
|
882
|
-
if datasource_type not in ("Remote URL", "Local file"):
|
|
898
|
+
if datasource_type not in ("remote_url", "local_file"):
|
|
883
899
|
default_name = f"ds_{generate_short_id()}"
|
|
884
900
|
name = name or click.prompt(
|
|
885
901
|
FeedbackManager.highlight(message=f"? Data source name [{default_name}]"),
|
|
@@ -887,13 +903,15 @@ async def datasource_create(
|
|
|
887
903
|
show_default=False,
|
|
888
904
|
)
|
|
889
905
|
|
|
890
|
-
if datasource_type == "
|
|
906
|
+
if datasource_type == "kafka":
|
|
891
907
|
connections = await client.connections("kafka")
|
|
892
908
|
kafka_connection_files = project.get_kafka_connection_files()
|
|
893
909
|
|
|
894
910
|
# if we have no topics from before and no connections, we need to build the project
|
|
895
911
|
if len(topics) == 0 and len(kafka_connection_files) != len(connections):
|
|
896
|
-
click.echo(
|
|
912
|
+
click.echo(
|
|
913
|
+
FeedbackManager.error(message=f"✗ Some {datasource_types[datasource_type][0]} connections are missing.")
|
|
914
|
+
)
|
|
897
915
|
if click.confirm(
|
|
898
916
|
FeedbackManager.highlight(message="? Do you want to build your project before continue? [Y/n]"),
|
|
899
917
|
show_default=False,
|
|
@@ -934,7 +952,7 @@ KAFKA_TOPIC {topic}
|
|
|
934
952
|
KAFKA_GROUP_ID {group_id}
|
|
935
953
|
"""
|
|
936
954
|
|
|
937
|
-
if datasource_type == "
|
|
955
|
+
if datasource_type == "s3":
|
|
938
956
|
if not connection:
|
|
939
957
|
connections = await client.connections("s3")
|
|
940
958
|
connection = next((c["name"] for c in connections if c["name"] == connection), connection)
|
|
@@ -944,7 +962,7 @@ IMPORT_BUCKET_URI "s3://my-bucket/*.csv"
|
|
|
944
962
|
IMPORT_SCHEDULE "@auto"
|
|
945
963
|
"""
|
|
946
964
|
|
|
947
|
-
if datasource_type == "
|
|
965
|
+
if datasource_type == "gcs":
|
|
948
966
|
if not connection:
|
|
949
967
|
connections = await client.connections("gcs")
|
|
950
968
|
connection = next((c["name"] for c in connections if c["name"] == connection), connection)
|
|
@@ -964,6 +982,20 @@ IMPORT_SCHEDULE "@auto"
|
|
|
964
982
|
ds_file.write_text(ds_content)
|
|
965
983
|
click.echo(FeedbackManager.success(message="✓ .datasource created!"))
|
|
966
984
|
|
|
985
|
+
if wizard_mode:
|
|
986
|
+
last_tip_message = "\nTip: To skip the interactive prompts, pass flags to this command, e.g."
|
|
987
|
+
last_tip_command = ""
|
|
988
|
+
if datasource_type == "local_file":
|
|
989
|
+
last_tip_command = f"`tb datasource create --file {file} --name {name}`."
|
|
990
|
+
elif datasource_type == "remote_url":
|
|
991
|
+
last_tip_command = f"`tb datasource create --url {url} --name {name}`."
|
|
992
|
+
elif datasource_type == "blank":
|
|
993
|
+
last_tip_command = f"`tb datasource create --blank --name {name}`."
|
|
994
|
+
elif datasource_type in ("s3", "gcs", "kafka"):
|
|
995
|
+
last_tip_command = f"`tb datasource create --{datasource_type} --name {name} --connection {connection}`."
|
|
996
|
+
|
|
997
|
+
click.echo(FeedbackManager.gray(message=(f"{last_tip_message} {last_tip_command}")))
|
|
998
|
+
|
|
967
999
|
|
|
968
1000
|
def generate_short_id():
|
|
969
1001
|
return str(uuid.uuid4())[:4]
|
|
@@ -69,6 +69,10 @@ def gray_message(message: str) -> Callable[..., str]:
|
|
|
69
69
|
return print_message(message, bcolors.CGREY)
|
|
70
70
|
|
|
71
71
|
|
|
72
|
+
def bold_message(message: str) -> Callable[..., str]:
|
|
73
|
+
return print_message(message, bcolors.BOLD)
|
|
74
|
+
|
|
75
|
+
|
|
72
76
|
class FeedbackManager:
|
|
73
77
|
error_exception = error_exception("{error}")
|
|
74
78
|
simple_error_exception = simple_error_message("{error}")
|
|
@@ -1204,3 +1208,4 @@ STEP 3: ADD KEY TO SERVICE ACCOUNT
|
|
|
1204
1208
|
gray = gray_message("{message}")
|
|
1205
1209
|
warning = warning_message("{message}")
|
|
1206
1210
|
build_result_error_title = print_message("\033[91m{message}", bcolors.BOLD)
|
|
1211
|
+
bold = bold_message("{message}")
|
|
@@ -165,22 +165,20 @@ def parse_fixed_params(fixed_params_list):
|
|
|
165
165
|
def create(ctx: Context) -> None:
|
|
166
166
|
"""Token creation commands.
|
|
167
167
|
|
|
168
|
-
You can create two types of tokens:
|
|
168
|
+
You can create two types of tokens: Static or JWT.
|
|
169
|
+
|
|
170
|
+
* Static Tokens do not have a TTL and can have any valid scope (ADMIN, TOKENS, or ORG_DATASOURCES:READ).
|
|
169
171
|
|
|
170
172
|
* JWT tokens have a TTL and can only have the PIPES:READ scope.Their main use case is allow your users to call your endpoints without exposing your API key.
|
|
171
173
|
|
|
172
|
-
* Static Tokens do not have a TTL and can have any valid scope (DATASOURCES:READ, DATASOURCES:APPEND, DATASOURCES:CREATE, DATASOURCES:DROP, PIPES:CREATE, PIPES:READ, PIPES:DROP).
|
|
173
174
|
|
|
174
175
|
Examples:
|
|
175
176
|
|
|
176
|
-
tb token create
|
|
177
|
-
|
|
178
|
-
tb token create static my_static_token --scope PIPES:READ --resource my_pipe
|
|
177
|
+
tb token create static my_static_token --scope ADMIN
|
|
179
178
|
|
|
180
|
-
tb token create static my_static_token --scope
|
|
181
|
-
|
|
182
|
-
tb token create static my_static_token --scope DATASOURCES:READ --resource my_datasource --filters "column_name=value"
|
|
179
|
+
tb token create static my_static_token --scope TOKENS
|
|
183
180
|
|
|
181
|
+
tb token create jwt my_jwt_token --ttl 1h --scope PIPES:READ --resource my_pipe
|
|
184
182
|
"""
|
|
185
183
|
|
|
186
184
|
|
|
@@ -248,13 +246,9 @@ async def create_jwt_token(ctx: Context, name: str, ttl: timedelta, scope, resou
|
|
|
248
246
|
|
|
249
247
|
# Valid scopes for Static Tokens
|
|
250
248
|
valid_scopes = [
|
|
251
|
-
"
|
|
252
|
-
"
|
|
253
|
-
"
|
|
254
|
-
"DATASOURCES:DROP",
|
|
255
|
-
"PIPES:CREATE",
|
|
256
|
-
"PIPES:READ",
|
|
257
|
-
"PIPES:DROP",
|
|
249
|
+
"ADMIN",
|
|
250
|
+
"TOKENS",
|
|
251
|
+
"ORG_DATASOURCES:READ",
|
|
258
252
|
]
|
|
259
253
|
|
|
260
254
|
|
|
@@ -271,8 +265,6 @@ class DynamicOptionsCommand(click.Command):
|
|
|
271
265
|
# Options
|
|
272
266
|
dynamic_options_help += "Options:\n"
|
|
273
267
|
dynamic_options_help += f" --scope [{','.join(valid_scopes)}] Scope for the token [Required]\n"
|
|
274
|
-
dynamic_options_help += " --resource TEXT Resource you want to associate the scope with\n"
|
|
275
|
-
dynamic_options_help += " --filter TEXT SQL condition used to filter the values when calling with this token (eg. --filter=value > 0) \n"
|
|
276
268
|
dynamic_options_help += " -h, --help Show this message and exit.\n"
|
|
277
269
|
|
|
278
270
|
return dynamic_options_help
|
|
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
|
{tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/build_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/build_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/format_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/datafile/pipe_checker.py
RENAMED
|
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
|
{tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb/modules/tinyunit/tinyunit_lib.py
RENAMED
|
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
|
{tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev221 → tinybird-0.0.1.dev223}/tinybird/tb_cli_modules/workspace_members.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|