tinybird 0.0.1.dev291__py3-none-any.whl → 1.0.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. tinybird/ch_utils/constants.py +5 -0
  2. tinybird/connectors.py +1 -7
  3. tinybird/context.py +3 -3
  4. tinybird/datafile/common.py +10 -8
  5. tinybird/datafile/parse_pipe.py +2 -2
  6. tinybird/feedback_manager.py +3 -0
  7. tinybird/prompts.py +1 -0
  8. tinybird/service_datasources.py +223 -0
  9. tinybird/sql_template.py +26 -11
  10. tinybird/sql_template_fmt.py +14 -4
  11. tinybird/tb/__cli__.py +2 -2
  12. tinybird/tb/cli.py +1 -0
  13. tinybird/tb/client.py +104 -26
  14. tinybird/tb/config.py +24 -0
  15. tinybird/tb/modules/agent/agent.py +103 -67
  16. tinybird/tb/modules/agent/banner.py +15 -15
  17. tinybird/tb/modules/agent/explore_agent.py +5 -0
  18. tinybird/tb/modules/agent/mock_agent.py +5 -1
  19. tinybird/tb/modules/agent/models.py +6 -2
  20. tinybird/tb/modules/agent/prompts.py +49 -2
  21. tinybird/tb/modules/agent/tools/deploy.py +1 -1
  22. tinybird/tb/modules/agent/tools/execute_query.py +15 -18
  23. tinybird/tb/modules/agent/tools/request_endpoint.py +1 -1
  24. tinybird/tb/modules/agent/tools/run_command.py +9 -0
  25. tinybird/tb/modules/agent/utils.py +38 -48
  26. tinybird/tb/modules/branch.py +150 -0
  27. tinybird/tb/modules/build.py +58 -13
  28. tinybird/tb/modules/build_common.py +209 -25
  29. tinybird/tb/modules/cli.py +129 -16
  30. tinybird/tb/modules/common.py +172 -146
  31. tinybird/tb/modules/connection.py +125 -194
  32. tinybird/tb/modules/connection_kafka.py +382 -0
  33. tinybird/tb/modules/copy.py +3 -1
  34. tinybird/tb/modules/create.py +83 -150
  35. tinybird/tb/modules/datafile/build.py +27 -38
  36. tinybird/tb/modules/datafile/build_datasource.py +21 -25
  37. tinybird/tb/modules/datafile/diff.py +1 -1
  38. tinybird/tb/modules/datafile/format_pipe.py +46 -7
  39. tinybird/tb/modules/datafile/playground.py +59 -68
  40. tinybird/tb/modules/datafile/pull.py +2 -3
  41. tinybird/tb/modules/datasource.py +477 -308
  42. tinybird/tb/modules/deployment.py +2 -0
  43. tinybird/tb/modules/deployment_common.py +84 -44
  44. tinybird/tb/modules/deprecations.py +4 -4
  45. tinybird/tb/modules/dev_server.py +33 -12
  46. tinybird/tb/modules/exceptions.py +14 -0
  47. tinybird/tb/modules/feedback_manager.py +1 -1
  48. tinybird/tb/modules/info.py +69 -12
  49. tinybird/tb/modules/infra.py +4 -5
  50. tinybird/tb/modules/job_common.py +15 -0
  51. tinybird/tb/modules/local.py +143 -23
  52. tinybird/tb/modules/local_common.py +347 -19
  53. tinybird/tb/modules/local_logs.py +209 -0
  54. tinybird/tb/modules/login.py +21 -2
  55. tinybird/tb/modules/login_common.py +254 -12
  56. tinybird/tb/modules/mock.py +5 -54
  57. tinybird/tb/modules/mock_common.py +0 -54
  58. tinybird/tb/modules/open.py +10 -5
  59. tinybird/tb/modules/project.py +14 -5
  60. tinybird/tb/modules/shell.py +15 -7
  61. tinybird/tb/modules/sink.py +3 -1
  62. tinybird/tb/modules/telemetry.py +11 -3
  63. tinybird/tb/modules/test.py +13 -9
  64. tinybird/tb/modules/test_common.py +13 -87
  65. tinybird/tb/modules/tinyunit/tinyunit.py +0 -14
  66. tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -6
  67. tinybird/tb/modules/watch.py +5 -3
  68. tinybird/tb_cli_modules/common.py +2 -2
  69. tinybird/tb_cli_modules/telemetry.py +1 -1
  70. tinybird/tornado_template.py +6 -7
  71. {tinybird-0.0.1.dev291.dist-info → tinybird-1.0.5.dist-info}/METADATA +32 -6
  72. tinybird-1.0.5.dist-info/RECORD +132 -0
  73. {tinybird-0.0.1.dev291.dist-info → tinybird-1.0.5.dist-info}/WHEEL +1 -1
  74. tinybird-0.0.1.dev291.dist-info/RECORD +0 -128
  75. {tinybird-0.0.1.dev291.dist-info → tinybird-1.0.5.dist-info}/entry_points.txt +0 -0
  76. {tinybird-0.0.1.dev291.dist-info → tinybird-1.0.5.dist-info}/top_level.txt +0 -0
@@ -214,41 +214,34 @@ def folder_playground(
214
214
  error=e,
215
215
  )
216
216
  raise click.ClickException(exception)
217
- else:
218
- if raise_on_exists:
219
- raise AlreadyExistsException(
220
- FeedbackManager.warning_name_already_exists(
221
- name=name if to_run[name]["version"] is None else f"{name}__v{to_run[name]['version']}"
222
- )
217
+ elif raise_on_exists:
218
+ raise AlreadyExistsException(
219
+ FeedbackManager.warning_name_already_exists(
220
+ name=name if to_run[name]["version"] is None else f"{name}__v{to_run[name]['version']}"
223
221
  )
222
+ )
223
+ elif name_matches_existing_resource(resource, name, tb_client):
224
+ if resource == "pipes":
225
+ click.echo(FeedbackManager.error_pipe_cannot_be_pushed(name=name))
224
226
  else:
225
- if name_matches_existing_resource(resource, name, tb_client):
226
- if resource == "pipes":
227
- click.echo(FeedbackManager.error_pipe_cannot_be_pushed(name=name))
228
- else:
229
- click.echo(FeedbackManager.error_datasource_cannot_be_pushed(name=name))
230
- else:
231
- click.echo(
232
- FeedbackManager.warning_name_already_exists(
233
- name=(
234
- name
235
- if to_run[name]["version"] is None
236
- else f"{name}__v{to_run[name]['version']}"
237
- )
238
- )
239
- )
240
- else:
227
+ click.echo(FeedbackManager.error_datasource_cannot_be_pushed(name=name))
228
+ else:
229
+ click.echo(
230
+ FeedbackManager.warning_name_already_exists(
231
+ name=(name if to_run[name]["version"] is None else f"{name}__v{to_run[name]['version']}")
232
+ )
233
+ )
234
+ if dry_run:
241
235
  if should_push_file(name, remote_resource_names, force, run_tests):
242
236
  extension = "pipe" if resource == "pipes" else "datasource"
243
237
  click.echo(FeedbackManager.info_building_resource(name=f"{name}.{extension}", version=""))
244
- else:
245
- if name_matches_existing_resource(resource, name, tb_client):
246
- if resource == "pipes":
247
- click.echo(FeedbackManager.warning_pipe_cannot_be_pushed(name=name))
248
- else:
249
- click.echo(FeedbackManager.warning_datasource_cannot_be_pushed(name=name))
238
+ elif name_matches_existing_resource(resource, name, tb_client):
239
+ if resource == "pipes":
240
+ click.echo(FeedbackManager.warning_pipe_cannot_be_pushed(name=name))
250
241
  else:
251
- click.echo(FeedbackManager.warning_dry_name_already_exists(name=name))
242
+ click.echo(FeedbackManager.warning_datasource_cannot_be_pushed(name=name))
243
+ else:
244
+ click.echo(FeedbackManager.warning_dry_name_already_exists(name=name))
252
245
 
253
246
  def push_files(
254
247
  dependency_graph: GraphDependencies,
@@ -793,44 +786,45 @@ def get_processed(
793
786
  dir_path=dir_path,
794
787
  embedded_datasources=embedded_ds,
795
788
  )
796
- else:
797
- if verbose:
798
- click.echo(FeedbackManager.info_processing_file(filename=filename))
789
+ continue
799
790
 
800
- if ".incl" in filename:
801
- click.echo(FeedbackManager.warning_skipping_include_file(file=filename))
791
+ if verbose:
792
+ click.echo(FeedbackManager.info_processing_file(filename=filename))
802
793
 
803
- if tb_client is None:
804
- raise ValueError("tb_client cannot be None")
794
+ if ".incl" in filename:
795
+ click.echo(FeedbackManager.warning_skipping_include_file(file=filename))
805
796
 
806
- name, warnings = process(
807
- filename=filename,
808
- tb_client=tb_client,
809
- deps=deps_list,
810
- dep_map=dep_map_dict,
811
- to_run=to_run_dict,
812
- vendor_paths=vendor_paths,
813
- skip_connectors=skip_connectors,
814
- current_ws=current_ws,
815
- changed=changed,
816
- fork_downstream=fork_downstream,
817
- is_internal=is_internal,
818
- dir_path=dir_path,
819
- verbose=verbose,
820
- embedded_datasources=embedded_ds,
821
- )
822
- processed_set.add(name)
797
+ if tb_client is None:
798
+ raise ValueError("tb_client cannot be None")
823
799
 
824
- if verbose:
825
- if len(warnings) == 1:
826
- click.echo(FeedbackManager.warning_pipe_restricted_param(word=warnings[0]))
827
- elif len(warnings) > 1:
828
- click.echo(
829
- FeedbackManager.warning_pipe_restricted_params(
830
- words=", ".join(["'{}'".format(param) for param in warnings[:-1]]),
831
- last_word=warnings[-1],
832
- )
800
+ name, warnings = process(
801
+ filename=filename,
802
+ tb_client=tb_client,
803
+ deps=deps_list,
804
+ dep_map=dep_map_dict,
805
+ to_run=to_run_dict,
806
+ vendor_paths=vendor_paths,
807
+ skip_connectors=skip_connectors,
808
+ current_ws=current_ws,
809
+ changed=changed,
810
+ fork_downstream=fork_downstream,
811
+ is_internal=is_internal,
812
+ dir_path=dir_path,
813
+ verbose=verbose,
814
+ embedded_datasources=embedded_ds,
815
+ )
816
+ processed_set.add(name)
817
+
818
+ if verbose:
819
+ if len(warnings) == 1:
820
+ click.echo(FeedbackManager.warning_pipe_restricted_param(word=warnings[0]))
821
+ elif len(warnings) > 1:
822
+ click.echo(
823
+ FeedbackManager.warning_pipe_restricted_params(
824
+ words=", ".join(["'{}'".format(param) for param in warnings[:-1]]),
825
+ last_word=warnings[-1],
833
826
  )
827
+ )
834
828
 
835
829
 
836
830
  def build_graph(
@@ -1082,11 +1076,8 @@ def process_file(
1082
1076
  raise click.ClickException(FeedbackManager.error_missing_table_arn(datasource=datasource["name"]))
1083
1077
  if not params.get("import_export_bucket", None):
1084
1078
  raise click.ClickException(FeedbackManager.error_missing_export_bucket(datasource=datasource["name"]))
1085
- else:
1086
- if not params.get("import_external_datasource", None):
1087
- raise click.ClickException(
1088
- FeedbackManager.error_missing_external_datasource(datasource=datasource["name"])
1089
- )
1079
+ elif not params.get("import_external_datasource", None):
1080
+ raise click.ClickException(FeedbackManager.error_missing_external_datasource(datasource=datasource["name"]))
1090
1081
 
1091
1082
  return params
1092
1083
 
@@ -1209,7 +1200,7 @@ def process_file(
1209
1200
  #
1210
1201
  # Note: any unknown import_ parameter is leaved as is.
1211
1202
  for key in ImportReplacements.get_datafile_parameter_keys():
1212
- replacement, default_value = ImportReplacements.get_api_param_for_datafile_param(service, key)
1203
+ replacement, default_value = ImportReplacements.get_api_param_for_datafile_param(key)
1213
1204
  if not replacement:
1214
1205
  continue # We should not reach this never, but just in case...
1215
1206
 
@@ -74,9 +74,8 @@ def folder_pull(
74
74
  if resource_to_write:
75
75
  fd.write(resource_to_write)
76
76
  return f
77
- else:
78
- if verbose:
79
- click.echo(FeedbackManager.info_skip_already_exists())
77
+ elif verbose:
78
+ click.echo(FeedbackManager.info_skip_already_exists())
80
79
  return None
81
80
  except Exception as e:
82
81
  raise click.ClickException(FeedbackManager.error_exception(error=e))