tinybird 0.0.1.dev21__py3-none-any.whl → 0.0.1.dev22__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tinybird might be problematic. Click here for more details.

tinybird/tb/__cli__.py CHANGED
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
4
4
  __url__ = 'https://www.tinybird.co/docs/cli/introduction.html'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '0.0.1.dev21'
8
- __revision__ = '523adc6'
7
+ __version__ = '0.0.1.dev22'
8
+ __revision__ = 'fad51ec'
@@ -689,6 +689,148 @@ class GraphDependencies:
689
689
  all_resources: Dict[str, Dict[str, Any]]
690
690
 
691
691
 
692
+ async def process(
693
+ filename: str,
694
+ tb_client: TinyB,
695
+ deps: List[str],
696
+ dep_map: Dict[str, Any],
697
+ to_run: Dict[str, Any],
698
+ vendor_paths: Optional[List[Tuple[str, str]]] = None,
699
+ skip_connectors: bool = False,
700
+ current_ws: Optional[Dict[str, Any]] = None,
701
+ changed: Optional[Dict[str, Any]] = None,
702
+ fork_downstream: Optional[bool] = False,
703
+ is_internal: Optional[bool] = False,
704
+ dir_path: Optional[str] = None,
705
+ verbose: bool = False,
706
+ embedded_datasources: Optional[Dict[str, Any]] = None,
707
+ ):
708
+ name, kind = filename.rsplit(".", 1)
709
+ warnings = []
710
+
711
+ try:
712
+ res = await process_file(
713
+ filename,
714
+ tb_client,
715
+ skip_connectors=skip_connectors,
716
+ current_ws=current_ws,
717
+ )
718
+ except click.ClickException as e:
719
+ raise e
720
+ except IncludeFileNotFoundException as e:
721
+ raise click.ClickException(FeedbackManager.error_deleted_include(include_file=str(e), filename=filename))
722
+ except Exception as e:
723
+ raise click.ClickException(str(e))
724
+
725
+ for r in res:
726
+ resource_name = r["resource_name"]
727
+ warnings = r.get("warnings", [])
728
+ if (
729
+ changed
730
+ and resource_name in changed
731
+ and (not changed[resource_name] or changed[resource_name] in ["shared", "remote"])
732
+ ):
733
+ continue
734
+
735
+ if (
736
+ fork_downstream
737
+ and r.get("resource", "") == "pipes"
738
+ and any(["engine" in x.get("params", {}) for x in r.get("nodes", [])])
739
+ ):
740
+ raise click.ClickException(FeedbackManager.error_forkdownstream_pipes_with_engine(pipe=resource_name))
741
+
742
+ to_run[resource_name] = r
743
+ file_deps = r.get("deps", [])
744
+ deps += file_deps
745
+ # calculate and look for deps
746
+ dep_list = []
747
+ for x in file_deps:
748
+ if x not in INTERNAL_TABLES or is_internal:
749
+ f, ds = find_file_by_name(dir_path, x, verbose, vendor_paths=vendor_paths, resource=r)
750
+ if f:
751
+ dep_list.append(f.rsplit(".", 1)[0])
752
+ if ds:
753
+ ds_fn = ds["resource_name"]
754
+ prev = to_run.get(ds_fn, {})
755
+ to_run[ds_fn] = deepcopy(r)
756
+ try:
757
+ to_run[ds_fn]["deps"] = list(
758
+ set(to_run[ds_fn].get("deps", []) + prev.get("deps", []) + [resource_name])
759
+ )
760
+ except ValueError:
761
+ pass
762
+ embedded_datasources[x] = to_run[ds_fn]
763
+ else:
764
+ e_ds = embedded_datasources.get(x, None)
765
+ if e_ds:
766
+ dep_list.append(e_ds["resource_name"])
767
+
768
+ dep_map[resource_name] = set(dep_list)
769
+ return os.path.basename(name), warnings
770
+
771
+
772
+ async def get_processed(
773
+ filenames: Iterable[str],
774
+ changed: Optional[Dict[str, Any]] = None,
775
+ verbose: bool = False,
776
+ deps: List[str] = [],
777
+ dep_map: Dict[str, Any] = {},
778
+ to_run: Dict[str, Any] = {},
779
+ vendor_paths: Optional[List[Tuple[str, str]]] = None,
780
+ processed: Set[str] = set(),
781
+ tb_client: TinyB = None,
782
+ skip_connectors: bool = False,
783
+ current_ws: Optional[Dict[str, Any]] = None,
784
+ fork_downstream: Optional[bool] = False,
785
+ is_internal: Optional[bool] = False,
786
+ dir_path: Optional[str] = None,
787
+ embedded_datasources: Optional[Dict[str, Any]] = None,
788
+ ):
789
+ for filename in filenames:
790
+ # just process changed filenames (tb deploy and --only-changes)
791
+ if changed:
792
+ resource = Path(filename).resolve().stem
793
+ if resource in changed and (not changed[resource] or changed[resource] in ["shared", "remote"]):
794
+ continue
795
+ if os.path.isdir(filename):
796
+ await get_processed(filenames=get_project_filenames(filename))
797
+ else:
798
+ if verbose:
799
+ click.echo(FeedbackManager.info_processing_file(filename=filename))
800
+
801
+ if ".incl" in filename:
802
+ click.echo(FeedbackManager.warning_skipping_include_file(file=filename))
803
+
804
+ name, warnings = await process(
805
+ filename=filename,
806
+ tb_client=tb_client,
807
+ deps=deps,
808
+ dep_map=dep_map,
809
+ to_run=to_run,
810
+ vendor_paths=vendor_paths,
811
+ skip_connectors=skip_connectors,
812
+ current_ws=current_ws,
813
+ changed=changed,
814
+ fork_downstream=fork_downstream,
815
+ is_internal=is_internal,
816
+ dir_path=dir_path,
817
+ verbose=verbose,
818
+ embedded_datasources=embedded_datasources,
819
+ )
820
+ processed.add(name)
821
+
822
+ if verbose:
823
+ if len(warnings) == 1:
824
+ click.echo(FeedbackManager.warning_pipe_restricted_param(word=warnings[0]))
825
+ elif len(warnings) > 1:
826
+ click.echo(
827
+ FeedbackManager.warning_pipe_restricted_params(
828
+ words=", ".join(["'{}'".format(param) for param in warnings[:-1]]),
829
+ last_word=warnings[-1],
830
+ )
831
+ )
832
+
833
+
692
834
  async def build_graph(
693
835
  filenames: Iterable[str],
694
836
  tb_client: TinyB,
@@ -740,109 +882,24 @@ async def build_graph(
740
882
  all_dep_map = all_dependencies_graph.dep_map
741
883
  all_resources = all_dependencies_graph.to_run
742
884
 
743
- async def process(
744
- filename: str,
745
- deps: List[str],
746
- dep_map: Dict[str, Any],
747
- to_run: Dict[str, Any],
748
- vendor_paths: Optional[List[Tuple[str, str]]],
749
- ):
750
- name, kind = filename.rsplit(".", 1)
751
- warnings = []
752
-
753
- try:
754
- res = await process_file(
755
- filename,
756
- tb_client,
757
- skip_connectors=skip_connectors,
758
- current_ws=current_ws,
759
- )
760
- except click.ClickException as e:
761
- raise e
762
- except IncludeFileNotFoundException as e:
763
- raise click.ClickException(FeedbackManager.error_deleted_include(include_file=str(e), filename=filename))
764
- except Exception as e:
765
- raise click.ClickException(str(e))
766
-
767
- for r in res:
768
- resource_name = r["resource_name"]
769
- warnings = r.get("warnings", [])
770
- if (
771
- changed
772
- and resource_name in changed
773
- and (not changed[resource_name] or changed[resource_name] in ["shared", "remote"])
774
- ):
775
- continue
776
-
777
- if (
778
- fork_downstream
779
- and r.get("resource", "") == "pipes"
780
- and any(["engine" in x.get("params", {}) for x in r.get("nodes", [])])
781
- ):
782
- raise click.ClickException(FeedbackManager.error_forkdownstream_pipes_with_engine(pipe=resource_name))
783
-
784
- to_run[resource_name] = r
785
- file_deps = r.get("deps", [])
786
- deps += file_deps
787
- # calculate and look for deps
788
- dep_list = []
789
- for x in file_deps:
790
- if x not in INTERNAL_TABLES or is_internal:
791
- f, ds = find_file_by_name(dir_path, x, verbose, vendor_paths=vendor_paths, resource=r)
792
- if f:
793
- dep_list.append(f.rsplit(".", 1)[0])
794
- if ds:
795
- ds_fn = ds["resource_name"]
796
- prev = to_run.get(ds_fn, {})
797
- to_run[ds_fn] = deepcopy(r)
798
- try:
799
- to_run[ds_fn]["deps"] = list(
800
- set(to_run[ds_fn].get("deps", []) + prev.get("deps", []) + [resource_name])
801
- )
802
- except ValueError:
803
- pass
804
- embedded_datasources[x] = to_run[ds_fn]
805
- else:
806
- e_ds = embedded_datasources.get(x, None)
807
- if e_ds:
808
- dep_list.append(e_ds["resource_name"])
809
-
810
- dep_map[resource_name] = set(dep_list)
811
- return os.path.basename(name), warnings
812
-
813
885
  processed = set()
814
886
 
815
- async def get_processed(filenames: Iterable[str]):
816
- for filename in filenames:
817
- # just process changed filenames (tb deploy and --only-changes)
818
- if changed:
819
- resource = Path(filename).resolve().stem
820
- if resource in changed and (not changed[resource] or changed[resource] in ["shared", "remote"]):
821
- continue
822
- if os.path.isdir(filename):
823
- await get_processed(filenames=get_project_filenames(filename))
824
- else:
825
- if verbose:
826
- click.echo(FeedbackManager.info_processing_file(filename=filename))
827
-
828
- if ".incl" in filename:
829
- click.echo(FeedbackManager.warning_skipping_include_file(file=filename))
830
-
831
- name, warnings = await process(filename, deps, dep_map, to_run, vendor_paths)
832
- processed.add(name)
833
-
834
- if verbose:
835
- if len(warnings) == 1:
836
- click.echo(FeedbackManager.warning_pipe_restricted_param(word=warnings[0]))
837
- elif len(warnings) > 1:
838
- click.echo(
839
- FeedbackManager.warning_pipe_restricted_params(
840
- words=", ".join(["'{}'".format(param) for param in warnings[:-1]]),
841
- last_word=warnings[-1],
842
- )
843
- )
844
-
845
- await get_processed(filenames=filenames)
887
+ await get_processed(
888
+ filenames=filenames,
889
+ tb_client=tb_client,
890
+ changed=changed,
891
+ deps=deps,
892
+ dep_map=dep_map,
893
+ to_run=to_run,
894
+ vendor_paths=vendor_paths,
895
+ processed=processed,
896
+ skip_connectors=skip_connectors,
897
+ current_ws=current_ws,
898
+ fork_downstream=fork_downstream,
899
+ is_internal=is_internal,
900
+ dir_path=dir_path,
901
+ embedded_datasources=embedded_datasources,
902
+ )
846
903
 
847
904
  if process_dependencies:
848
905
  if only_changes:
@@ -878,7 +935,21 @@ async def build_graph(
878
935
  click.echo(FeedbackManager.info_skipping_resource(resource=processed_filename))
879
936
  continue
880
937
  click.echo(FeedbackManager.info_processing_file(filename=processed_filename))
881
- await process(str(f), deps, dep_map, to_run, vendor_paths)
938
+ await process(
939
+ filename=str(f),
940
+ tb_client=tb_client,
941
+ deps=deps,
942
+ dep_map=dep_map,
943
+ to_run=to_run,
944
+ vendor_paths=vendor_paths,
945
+ skip_connectors=skip_connectors,
946
+ current_ws=current_ws,
947
+ fork_downstream=fork_downstream,
948
+ is_internal=is_internal,
949
+ dir_path=dir_path,
950
+ verbose=verbose,
951
+ embedded_datasources=embedded_datasources,
952
+ )
882
953
 
883
954
  return GraphDependencies(dep_map, to_run, all_dep_map, all_resources)
884
955
 
@@ -60,6 +60,7 @@ def start_tinybird_local(
60
60
 
61
61
  click.echo(FeedbackManager.info(message="* Waiting for Tinybird Local to be ready..."))
62
62
  while True:
63
+ container.reload() # Refresh container attributes
63
64
  health = container.attrs.get("State", {}).get("Health", {}).get("Status")
64
65
  if health == "healthy":
65
66
  break
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird
3
- Version: 0.0.1.dev21
3
+ Version: 0.0.1.dev22
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -15,7 +15,7 @@ tinybird/syncasync.py,sha256=fAvq0qkRgqXqXMKwbY2iJNYqLT_r6mDsh1MRpGKrdRU,27763
15
15
  tinybird/tornado_template.py,sha256=o2HguxrL1Evnt8o3IvrsI8Zm6JtRQ3zhLJKf1XyR3SQ,41965
16
16
  tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
17
17
  tinybird/ch_utils/engine.py,sha256=OXkBhlzGjZotjD0vaT-rFIbSGV4tpiHxE8qO_ip0SyQ,40454
18
- tinybird/tb/__cli__.py,sha256=1VxxptKXBoOejwGSsyZYVR5OdTVsLgpfAiAB6C5DI3c,251
18
+ tinybird/tb/__cli__.py,sha256=X2PDOP_pElDefrfQdab_-Df296RDkCK0nKLzdihDVJk,251
19
19
  tinybird/tb/cli.py,sha256=onCxcKvTV4RuokC5V3t82OXWAIwgU6pMWs8rpWOUi_o,815
20
20
  tinybird/tb/modules/auth.py,sha256=EzRWFmwRkXNhUmRaruEVFLdkbUg8xMSix0cAWl5D4Jg,9029
21
21
  tinybird/tb/modules/build.py,sha256=qJsmJCphanQitSnv86dqeoThM7mOg9Yg9JJLQjQ56ws,7074
@@ -31,7 +31,7 @@ tinybird/tb/modules/feedback_manager.py,sha256=a76KSrIdtNT5cs56jMYUfpqoXMwEPq_SE
31
31
  tinybird/tb/modules/fmt.py,sha256=poh6_cwVGSf-sBu6LKWuO2TANL_J8Sgm25sPpwxa3Aw,3558
32
32
  tinybird/tb/modules/job.py,sha256=956Pj8BEEsiD2GZsV9RKKVM3I_CveOLgS82lykO5ukk,2963
33
33
  tinybird/tb/modules/llm.py,sha256=9oJzI213eFv68Ttcfl3XNgEetaxfr6m56s2-IyBhNZ8,2713
34
- tinybird/tb/modules/local.py,sha256=xWUVQzGw2bdWrezJd2Qa3YmXnpg4VdGtQduJpPfKMck,5194
34
+ tinybird/tb/modules/local.py,sha256=n8L1tH0LlCwGEM7K_1jHeCRdqjtW9BbpCIibI4IgeaM,5253
35
35
  tinybird/tb/modules/local_common.py,sha256=oemeKBCdEkNHXuGv1p6I9vhjkSXvqDsV5kT-rPN3mvk,2145
36
36
  tinybird/tb/modules/login.py,sha256=KYGpM35fsjIVkp04Xm1kHvlEOXysRSvLfBUNTxNx26A,6044
37
37
  tinybird/tb/modules/mock.py,sha256=BbDe60Qdlxg5-WewxFYRPETNBExj1qqBn5Ngz5T8G2Q,3231
@@ -46,7 +46,7 @@ tinybird/tb/modules/token.py,sha256=AePr-QMv_vtWwZDWQ92Zp0kPrCjze61i4npiPhoLMZg,
46
46
  tinybird/tb/modules/watch.py,sha256=xCIUvqTgeb2s63CYw26czgUGV3zzJpdmuyHGH2TLp1E,2349
47
47
  tinybird/tb/modules/workspace.py,sha256=6icAgnTvfL3d1kx4L1Z1cGXCD_2Yx0fNRjbZHNxRbYc,10927
48
48
  tinybird/tb/modules/workspace_members.py,sha256=Ai6iCOzXX1zQ8q9iXIFSFHsBJlT-8Q28DaG5Ie-UweY,8726
49
- tinybird/tb/modules/datafile/build.py,sha256=ICr9FvWQfW99aKnygbUOZPvivD6qaR31ZsQ7nNI2GLg,54309
49
+ tinybird/tb/modules/datafile/build.py,sha256=i8UTYzB1_vWOJrmule_655FLEBj6sZzyiffQg-HsPJ4,56459
50
50
  tinybird/tb/modules/datafile/build_common.py,sha256=IXl-Z51zUi1dypV7meNenX0iu2UmowNeqgG6WHyMHlk,4562
51
51
  tinybird/tb/modules/datafile/build_datasource.py,sha256=4aP8_DYCRGghXntZSeWDNJxjps1QRVa7WHoYCzQwQts,17355
52
52
  tinybird/tb/modules/datafile/build_pipe.py,sha256=iu6_1eNEI5f2wm7AfDhLyMCwsqBtrAwkP_1yL4XTHOs,27659
@@ -69,8 +69,8 @@ tinybird/tb_cli_modules/config.py,sha256=6NTgIdwf0X132A1j6G_YrdPep87ymZ9b5pABabK
69
69
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
70
70
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
71
71
  tinybird/tb_cli_modules/telemetry.py,sha256=iEGnMuCuNhvF6ln__j6X9MSTwL_0Hm-GgFHHHvhfknk,10466
72
- tinybird-0.0.1.dev21.dist-info/METADATA,sha256=FMzNtUcWW-VbxL1Fvu5zVrBsEJb0mDEowNSDKibTL0U,2446
73
- tinybird-0.0.1.dev21.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
74
- tinybird-0.0.1.dev21.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
75
- tinybird-0.0.1.dev21.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
76
- tinybird-0.0.1.dev21.dist-info/RECORD,,
72
+ tinybird-0.0.1.dev22.dist-info/METADATA,sha256=tjKF0zgTPtEhfgPlmDM3dJcqpe5R8j55aoeXgjZfxNM,2446
73
+ tinybird-0.0.1.dev22.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
74
+ tinybird-0.0.1.dev22.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
75
+ tinybird-0.0.1.dev22.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
76
+ tinybird-0.0.1.dev22.dist-info/RECORD,,