tinybird 0.0.1.dev166__tar.gz → 0.0.1.dev168__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.

Files changed (110) hide show
  1. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/PKG-INFO +1 -1
  2. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/ch_utils/engine.py +5 -2
  3. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/__cli__.py +2 -2
  4. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/deployment.py +13 -0
  5. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/local_common.py +70 -7
  6. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird.egg-info/PKG-INFO +1 -1
  7. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/setup.cfg +0 -0
  8. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/__cli__.py +0 -0
  9. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/ch_utils/constants.py +0 -0
  10. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/check_pypi.py +0 -0
  11. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/client.py +0 -0
  12. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/config.py +0 -0
  13. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/connectors.py +0 -0
  14. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/context.py +0 -0
  15. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/datafile.py +0 -0
  16. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/datatypes.py +0 -0
  17. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/feedback_manager.py +0 -0
  18. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/git_settings.py +0 -0
  19. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/prompts.py +0 -0
  20. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/sql.py +0 -0
  21. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/sql_template.py +0 -0
  22. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/sql_template_fmt.py +0 -0
  23. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/sql_toolset.py +0 -0
  24. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/syncasync.py +0 -0
  25. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/check_pypi.py +0 -0
  26. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/cli.py +0 -0
  27. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/client.py +0 -0
  28. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/config.py +0 -0
  29. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/build.py +0 -0
  30. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/cicd.py +0 -0
  31. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/cli.py +0 -0
  32. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/common.py +0 -0
  33. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/config.py +0 -0
  34. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/connection.py +0 -0
  35. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/copy.py +0 -0
  36. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/create.py +0 -0
  37. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/build.py +0 -0
  38. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/build_common.py +0 -0
  39. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
  40. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
  41. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/common.py +0 -0
  42. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/diff.py +0 -0
  43. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/exceptions.py +0 -0
  44. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/fixture.py +0 -0
  45. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/format_common.py +0 -0
  46. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
  47. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
  48. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/parse_datasource.py +0 -0
  49. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/parse_pipe.py +0 -0
  50. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
  51. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/playground.py +0 -0
  52. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datafile/pull.py +0 -0
  53. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/datasource.py +0 -0
  54. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/deprecations.py +0 -0
  55. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/dev_server.py +0 -0
  56. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/endpoint.py +0 -0
  57. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/exceptions.py +0 -0
  58. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/feedback_manager.py +0 -0
  59. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/info.py +0 -0
  60. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/infra.py +0 -0
  61. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/job.py +0 -0
  62. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/llm.py +0 -0
  63. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/llm_utils.py +0 -0
  64. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/local.py +0 -0
  65. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/login.py +0 -0
  66. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/logout.py +0 -0
  67. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/materialization.py +0 -0
  68. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/mock.py +0 -0
  69. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/open.py +0 -0
  70. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/pipe.py +0 -0
  71. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/project.py +0 -0
  72. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/regions.py +0 -0
  73. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/secret.py +0 -0
  74. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/shell.py +0 -0
  75. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/table.py +0 -0
  76. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/telemetry.py +0 -0
  77. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/test.py +0 -0
  78. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
  79. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
  80. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/token.py +0 -0
  81. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/watch.py +0 -0
  82. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/workspace.py +0 -0
  83. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb/modules/workspace_members.py +0 -0
  84. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli.py +0 -0
  85. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/auth.py +0 -0
  86. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/branch.py +0 -0
  87. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/cicd.py +0 -0
  88. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/cli.py +0 -0
  89. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/common.py +0 -0
  90. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/config.py +0 -0
  91. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/connection.py +0 -0
  92. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/datasource.py +0 -0
  93. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/exceptions.py +0 -0
  94. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/fmt.py +0 -0
  95. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/job.py +0 -0
  96. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/pipe.py +0 -0
  97. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/regions.py +0 -0
  98. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/tag.py +0 -0
  99. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/telemetry.py +0 -0
  100. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/test.py +0 -0
  101. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  102. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  103. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/workspace.py +0 -0
  104. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  105. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird/tornado_template.py +0 -0
  106. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird.egg-info/SOURCES.txt +0 -0
  107. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird.egg-info/dependency_links.txt +0 -0
  108. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird.egg-info/entry_points.txt +0 -0
  109. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird.egg-info/requires.txt +0 -0
  110. {tinybird-0.0.1.dev166 → tinybird-0.0.1.dev168}/tinybird.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev166
3
+ Version: 0.0.1.dev168
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -146,10 +146,9 @@ class TableDetails:
146
146
  def is_replacing_engine(self) -> bool:
147
147
  if self.engine:
148
148
  engine_lower = self.engine.lower()
149
- is_aggregating = "aggregatingmergetree" in engine_lower
150
149
  is_replacing = "replacingmergetree" in engine_lower
151
150
  is_collapsing = "collapsingmergetree" in engine_lower
152
- return is_aggregating or is_replacing or is_collapsing
151
+ return is_replacing or is_collapsing
153
152
  return False
154
153
 
155
154
  def diff_ttl(self, new_ttl: str) -> bool:
@@ -169,6 +168,10 @@ class TableDetails:
169
168
  @property
170
169
  def sorting_key(self) -> Optional[str]:
171
170
  _sorting_key = self.details.get("sorting_key", None)
171
+ # TODO: This should use ENABLED_ENGINES to guess if the sorting key is required or not
172
+ # Also checking this and raising an error in a getter is a bit of an anti-pattern,
173
+ # a data source could have a "wrong" sorting key and we won't be able to even show it in the API.
174
+ # All these checks be performed only on creation time.
172
175
  if self.is_replacing_engine() and not _sorting_key:
173
176
  raise ValueError(f"SORTING_KEY must be defined for the {self.engine} engine")
174
177
  if self.is_mergetree_family():
@@ -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.dev166'
8
- __revision__ = 'dfe3726'
7
+ __version__ = '0.0.1.dev168'
8
+ __revision__ = 'd746fb3'
@@ -468,6 +468,19 @@ def create_deployment_cmd(
468
468
  template: Optional[str] = None,
469
469
  ) -> None:
470
470
  if template:
471
+ project = ctx.ensure_object(dict)["project"]
472
+ if project.get_project_files():
473
+ click.echo(
474
+ FeedbackManager.error(
475
+ message="You are trying to deploy a template from a folder that already contains data files. "
476
+ "Please remove the data files from the current folder or use a different folder and try again."
477
+ )
478
+ )
479
+ sys_exit(
480
+ "deployment_error",
481
+ "Deployment using a template is not allowed when the project already contains data files",
482
+ )
483
+
471
484
  click.echo(FeedbackManager.info(message="» Downloading template..."))
472
485
  try:
473
486
  download_github_template(template)
@@ -109,22 +109,84 @@ def get_local_tokens() -> Dict[str, str]:
109
109
  # ruff: noqa: ASYNC210
110
110
  return requests.get(f"{TB_LOCAL_ADDRESS}/tokens").json()
111
111
  except Exception:
112
+ # Check if tinybird-local is running using docker client (some clients use podman and won't have docker cmd)
112
113
  try:
113
- # Check if tinybird-local is running with docker, in case it's a config issue
114
- output = subprocess.check_output(["docker", "ps"], text=True)
115
- header_row = next((line for line in output.splitlines() if "CONTAINER ID" in line), "")
116
- tb_local_row = next(
117
- (line for line in output.splitlines() if TB_CONTAINER_NAME in line),
118
- f"{TB_CONTAINER_NAME} not found in output",
114
+ docker_client = get_docker_client()
115
+ container = get_existing_container_with_matching_env(docker_client, TB_CONTAINER_NAME, {})
116
+
117
+ output = {}
118
+ if container:
119
+ output = container.attrs
120
+ add_telemetry_event(
121
+ "docker_debug",
122
+ data={
123
+ "container_attrs": output,
124
+ },
119
125
  )
126
+
127
+ if container and container.status == "running":
128
+ if container.health == "healthy":
129
+ raise CLILocalException(
130
+ FeedbackManager.error(
131
+ message=(
132
+ "Looks like Tinybird Local is running but we are not able to connect to it.\n\n"
133
+ "If you've run it manually using different host or port, please set the environment variables "
134
+ "TB_LOCAL_HOST and TB_LOCAL_PORT to match the ones you're using.\n"
135
+ "If you're not sure about this, please run `tb local restart` and try again."
136
+ )
137
+ )
138
+ )
139
+ raise CLILocalException(
140
+ FeedbackManager.error(
141
+ message=(
142
+ "Tinybird Local is running but it's unhealthy. Please check if it's running and try again.\n"
143
+ "If the problem persists, please run `tb local restart` and try again."
144
+ )
145
+ )
146
+ )
147
+ except CLILocalException as e:
148
+ raise e
149
+ except Exception:
150
+ pass
151
+
152
+ # Check if tinybird-local is running with docker
153
+ try:
154
+ output_str = subprocess.check_output(
155
+ ["docker", "ps", "--filter", f"name={TB_CONTAINER_NAME}", "--format", "json"], text=True
156
+ )
157
+ output = {}
158
+ if output_str:
159
+ output = json.loads(output_str)
120
160
  add_telemetry_event(
121
161
  "docker_debug",
122
162
  data={
123
- "docker_ps_output": header_row + tb_local_row,
163
+ "docker_ps_output": output,
124
164
  },
125
165
  )
166
+
167
+ if output.get("State", "") == "running":
168
+ if "(healthy)" in output.get("Status", ""):
169
+ raise CLILocalException(
170
+ FeedbackManager.error(
171
+ message=(
172
+ "Looks like Tinybird Local is running but we are not able to connect to it.\n\n"
173
+ "If you've run it manually using different host or port, please set the environment variables "
174
+ "TB_LOCAL_HOST and TB_LOCAL_PORT to match the ones you're using.\n"
175
+ "If you're not sure about this, please run `tb local restart` and try again."
176
+ )
177
+ )
178
+ )
179
+ raise CLILocalException(
180
+ FeedbackManager.error(
181
+ message="Tinybird Local is running but it's unhealthy. Please check if it's running and try again.\n"
182
+ "If the problem persists, please run `tb local restart` and try again."
183
+ )
184
+ )
185
+ except CLILocalException as e:
186
+ raise e
126
187
  except Exception:
127
188
  pass
189
+
128
190
  is_ci = (
129
191
  os.getenv("GITHUB_ACTIONS")
130
192
  or os.getenv("TRAVIS")
@@ -146,6 +208,7 @@ def get_local_tokens() -> Dict[str, str]:
146
208
  start_tinybird_local(docker_client, False)
147
209
  click.echo(FeedbackManager.success(message="✓ Tinybird Local is ready!"))
148
210
  return get_local_tokens()
211
+
149
212
  raise CLILocalException(
150
213
  FeedbackManager.error(message="Tinybird local is not running. Please run `tb local start` first.")
151
214
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev166
3
+ Version: 0.0.1.dev168
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird