tinybird 0.0.1.dev280__py3-none-any.whl → 0.0.1.dev281__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/forward/commands'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '0.0.1.dev280'
8
- __revision__ = 'e419ff7'
7
+ __version__ = '0.0.1.dev281'
8
+ __revision__ = 'a7365be'
@@ -16,7 +16,7 @@ from requests import Response
16
16
 
17
17
  from tinybird.tb.check_pypi import CheckPypi
18
18
  from tinybird.tb.client import TinyB
19
- from tinybird.tb.config import CURRENT_VERSION
19
+ from tinybird.tb.config import CURRENT_VERSION, get_display_cloud_host
20
20
  from tinybird.tb.modules.agent.animations import ThinkingAnimation
21
21
  from tinybird.tb.modules.agent.banner import display_banner
22
22
  from tinybird.tb.modules.agent.command_agent import CommandAgent
@@ -212,7 +212,12 @@ class TinybirdAgent:
212
212
 
213
213
  @self.agent.instructions
214
214
  def get_local_host(ctx: RunContext[TinybirdAgentContext]) -> str:
215
- return f"Tinybird Local host: {ctx.deps.local_host}"
215
+ return f"""
216
+ # Tinybird Local info:
217
+ - API Host: {ctx.deps.local_host}
218
+ - Token: {ctx.deps.local_token}
219
+ - UI Dashboard URL: {get_display_cloud_host(ctx.deps.local_host)}/{ctx.deps.workspace_name}
220
+ """
216
221
 
217
222
  @self.agent.instructions
218
223
  def get_cloud_host(ctx: RunContext[TinybirdAgentContext]) -> str:
@@ -230,12 +235,14 @@ class TinybirdAgent:
230
235
 
231
236
  region_provider = region["provider"]
232
237
  region_name = region["name"]
233
- return f"""Tinybird Cloud info (region details):
238
+ return f"""
239
+ # Tinybird Cloud info (region details):
234
240
  - API Host: {ctx.deps.host}
235
241
  - Workspace ID: {ctx.deps.workspace_id}
236
242
  - Workspace Name: {project.workspace_name} (in Tinybird Local the workspace name is the same because it is synced with Cloud)
237
243
  - Region provider: {region_provider}
238
244
  - Region name: {region_name}
245
+ - UI Dashboard URL: {get_display_cloud_host(ctx.deps.host)}/{ctx.deps.workspace_name}
239
246
  """
240
247
 
241
248
  @self.agent.instructions
@@ -5,7 +5,6 @@ from typing import Any
5
5
  from pydantic_ai import format_as_xml
6
6
 
7
7
  from tinybird.prompts import (
8
- copy_pipe_instructions,
9
8
  datasource_example,
10
9
  datasource_instructions,
11
10
  materialized_pipe_instructions,
@@ -35,6 +34,8 @@ available_commands = [
35
34
  "`tb sink ls`: List all sinks",
36
35
  "`tb workspace current`: Show the current workspace",
37
36
  "`tb workspace clear --yes`: Delete all resources in the workspace (Only available in Tinybird Local)",
37
+ "`tb local start --skip-new-version`: Start Tinybird Local container in non-interactive mode",
38
+ "`tb local restart --skip-new-version --yes`: Restart Tinybird Local container in non-interactive mode",
38
39
  ]
39
40
 
40
41
  plan_instructions = """
@@ -778,6 +779,37 @@ GCS_HMAC_SECRET {{ tb_secret("gcs_hmac_secret") }}
778
779
  ```
779
780
  """
780
781
 
782
+
783
+ copy_pipe_instructions = """
784
+ - Copy pipes should be created in the /copies folder.
785
+ - In a .pipe file you can define how to export the result of a Pipe to a Data Source, optionally with a schedule.
786
+ - Do not include `COPY_SCHEDULE` in the .pipe file unless is specifically requested by the user.
787
+ - `COPY_SCHEDULE` is a cron expression that defines the schedule of the copy pipe.
788
+ - `COPY_SCHEDULE` is optional and if not provided, the copy pipe will be executed only once.
789
+ - `TARGET_DATASOURCE` is the name of the Data Source to export the result to.
790
+ - `TYPE COPY` is the type of the pipe and it is mandatory for copy pipes.
791
+ - If the copy pipe uses parameters, you must include the `%` character and a newline on top of every query to be able to use the parameters.
792
+ - The content of the .pipe file must follow this format:
793
+
794
+ <copy_pipe_example>
795
+ DESCRIPTION Copy Pipe to export sales hour every hour to the sales_hour_copy Data Source
796
+
797
+ NODE daily_sales
798
+ SQL >
799
+ %
800
+ SELECT toStartOfDay(starting_date) day, country, sum(sales) as total_sales
801
+ FROM teams
802
+ WHERE
803
+ day BETWEEN toStartOfDay(now()) - interval 1 day AND toStartOfDay(now())
804
+ and country = {{ String(country, 'US')}}
805
+ GROUP BY day, country
806
+
807
+ TYPE COPY
808
+ TARGET_DATASOURCE sales_hour_copy
809
+ COPY_SCHEDULE 0 * * * *
810
+ </copy_pipe_example>
811
+ """
812
+
781
813
  agent_system_prompt = f"""
782
814
  You are a Tinybird Code, an agentic CLI that can help users to work with Tinybird.
783
815
 
@@ -867,6 +899,18 @@ where <scope> is one of the following: `TOKENS`, `ADMIN`, `ORG_DATASOURCES:READ`
867
899
  {sink_pipe_instructions}
868
900
 
869
901
  # Working with copy pipe files:
902
+
903
+ ## What are copy pipes?
904
+ Copy pipes capture the result of a pipe at a moment in time and write the result into a target data source.
905
+ They can be run on a schedule, or executed on demand.
906
+
907
+ ## Use copy pipes for:
908
+ - Event-sourced snapshots, such as change data capture (CDC).
909
+ - Copy data from Tinybird to another location in Tinybird to experiment.
910
+ - De-duplicate with snapshots.
911
+ - Copy pipes should not be confused with materialized views. While materialized views continuously update as new events are inserted, copy pipes generate a single snapshot at a specific point in time.
912
+
913
+ ## Copy pipe instructions
870
914
  {copy_pipe_instructions}
871
915
 
872
916
  # Working with SQL queries:
@@ -913,6 +957,10 @@ where <scope> is one of the following: `TOKENS`, `ADMIN`, `ORG_DATASOURCES:READ`
913
957
  # When asked about the files in the project:
914
958
  - You can rely in your own context to answer the question.
915
959
 
960
+ # When you need to copy/export data from the selected environment to a local file:
961
+ - Use `explore_data` tool to export data from the selected environment to a local file.
962
+ - Copy pipes do not copy data between environments, they are only used to copy data between data sources in the same environment.
963
+
916
964
  # Info
917
965
  Today is {datetime.now().strftime("%Y-%m-%d")}
918
966
  """
@@ -119,7 +119,13 @@ def remove() -> None:
119
119
  default=None,
120
120
  help="Path to the volumes directory. If not provided, the container data won't be persisted.",
121
121
  )
122
- def start(use_aws_creds: bool, volumes_path: str) -> None:
122
+ @click.option(
123
+ "--skip-new-version",
124
+ default=False,
125
+ is_flag=True,
126
+ help="Skip pulling the latest Tinybird Local image. Use directly your current local image.",
127
+ )
128
+ def start(use_aws_creds: bool, volumes_path: str, skip_new_version: bool) -> None:
123
129
  """Start Tinybird Local"""
124
130
  if volumes_path is not None:
125
131
  absolute_path = Path(volumes_path).absolute()
@@ -128,7 +134,7 @@ def start(use_aws_creds: bool, volumes_path: str) -> None:
128
134
 
129
135
  click.echo(FeedbackManager.highlight(message="» Starting Tinybird Local..."))
130
136
  docker_client = get_docker_client()
131
- start_tinybird_local(docker_client, use_aws_creds, volumes_path)
137
+ start_tinybird_local(docker_client, use_aws_creds, volumes_path, skip_new_version)
132
138
  click.echo(FeedbackManager.success(message="✓ Tinybird Local is ready!"))
133
139
 
134
140
 
@@ -144,7 +150,19 @@ def start(use_aws_creds: bool, volumes_path: str) -> None:
144
150
  default=None,
145
151
  help="Path to the volumes directory. If not provided, the container data won't be persisted.",
146
152
  )
147
- def restart(use_aws_creds: bool, volumes_path: str) -> None:
153
+ @click.option(
154
+ "--skip-new-version",
155
+ default=False,
156
+ is_flag=True,
157
+ help="Skip pulling the latest Tinybird Local image. Use directly your current local image.",
158
+ )
159
+ @click.option(
160
+ "--yes",
161
+ default=False,
162
+ is_flag=True,
163
+ help="Skip the confirmation prompt. If provided, the container will be restarted without asking for confirmation.",
164
+ )
165
+ def restart(use_aws_creds: bool, volumes_path: str, skip_new_version: bool, yes: bool) -> None:
148
166
  """Restart Tinybird Local"""
149
167
  if volumes_path is not None:
150
168
  absolute_path = Path(volumes_path).absolute()
@@ -153,9 +171,10 @@ def restart(use_aws_creds: bool, volumes_path: str) -> None:
153
171
 
154
172
  click.echo(FeedbackManager.highlight(message="» Restarting Tinybird Local..."))
155
173
  docker_client = get_docker_client()
156
- remove_tinybird_local(docker_client, volumes_path is not None)
174
+ persist_data = volumes_path is not None or yes
175
+ remove_tinybird_local(docker_client, persist_data)
157
176
  click.echo(FeedbackManager.info(message="✓ Tinybird Local stopped"))
158
- start_tinybird_local(docker_client, use_aws_creds, volumes_path)
177
+ start_tinybird_local(docker_client, use_aws_creds, volumes_path, skip_new_version)
159
178
  click.echo(FeedbackManager.success(message="✓ Tinybird Local is ready!"))
160
179
 
161
180
 
@@ -220,29 +220,32 @@ def start_tinybird_local(
220
220
  docker_client: DockerClient,
221
221
  use_aws_creds: bool,
222
222
  volumes_path: Optional[str] = None,
223
+ skip_new_version: bool = False,
223
224
  ) -> None:
224
225
  """Start the Tinybird container."""
225
226
  pull_show_prompt = False
226
227
  pull_required = False
227
- try:
228
- local_image = docker_client.images.get(TB_IMAGE_NAME)
229
- local_image_id = local_image.attrs["RepoDigests"][0].split("@")[1]
230
- remote_image = docker_client.images.get_registry_data(TB_IMAGE_NAME)
231
- pull_show_prompt = local_image_id != remote_image.id
232
- except Exception:
233
- pull_show_prompt = False
234
- pull_required = True
235
-
236
- if pull_show_prompt and click.confirm(
237
- FeedbackManager.warning(message="△ New version detected, download? [y/N]:"),
238
- show_default=False,
239
- prompt_suffix="",
240
- ):
241
- click.echo(FeedbackManager.info(message="* Downloading latest version of Tinybird Local..."))
242
- pull_required = True
243
-
244
- if pull_required:
245
- docker_client.images.pull(TB_IMAGE_NAME, platform="linux/amd64")
228
+
229
+ if not skip_new_version:
230
+ try:
231
+ local_image = docker_client.images.get(TB_IMAGE_NAME)
232
+ local_image_id = local_image.attrs["RepoDigests"][0].split("@")[1]
233
+ remote_image = docker_client.images.get_registry_data(TB_IMAGE_NAME)
234
+ pull_show_prompt = local_image_id != remote_image.id
235
+ except Exception:
236
+ pull_show_prompt = False
237
+ pull_required = True
238
+
239
+ if pull_show_prompt and click.confirm(
240
+ FeedbackManager.warning(message="△ New version detected, download? [y/N]:"),
241
+ show_default=False,
242
+ prompt_suffix="",
243
+ ):
244
+ click.echo(FeedbackManager.info(message="* Downloading latest version of Tinybird Local..."))
245
+ pull_required = True
246
+
247
+ if pull_required:
248
+ docker_client.images.pull(TB_IMAGE_NAME, platform="linux/amd64")
246
249
 
247
250
  environment = get_use_aws_creds() if use_aws_creds else {}
248
251
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev280
3
+ Version: 0.0.1.dev281
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -17,7 +17,7 @@ tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1w
17
17
  tinybird/datafile/parse_connection.py,sha256=tRyn2Rpr1TeWet5BXmMoQgaotbGdYep1qiTak_OqC5E,1825
18
18
  tinybird/datafile/parse_datasource.py,sha256=ssW8QeFSgglVFi3sDZj_HgkJiTJ2069v2JgqnH3CkDE,1825
19
19
  tinybird/datafile/parse_pipe.py,sha256=xf4m0Tw44QWJzHzAm7Z7FwUoUUtr7noMYjU1NiWnX0k,3880
20
- tinybird/tb/__cli__.py,sha256=Np8R1vyZCw8RP4hNX8uKd29Sq7xRKM_5NOXdcYnx258,247
20
+ tinybird/tb/__cli__.py,sha256=9wnnbBnxhukXrxUWvBtiFSmvyluJ20h0GDJBGnLWbwc,247
21
21
  tinybird/tb/check_pypi.py,sha256=Gp0HkHHDFMSDL6nxKlOY51z7z1Uv-2LRexNTZSHHGmM,552
22
22
  tinybird/tb/cli.py,sha256=FdDFEIayjmsZEVsVSSvRiVYn_FHOVg_zWQzchnzfWho,1008
23
23
  tinybird/tb/client.py,sha256=IQRaInDjOwr9Fzaz3_xXc3aUGqh94tM2lew7IZbB9eM,53733
@@ -44,8 +44,8 @@ tinybird/tb/modules/infra.py,sha256=JE9oLIyF4bi_JBoe-BgZ5HhKp_lQgSihuSV1KIS02Qs,
44
44
  tinybird/tb/modules/job.py,sha256=wBsnu8UPTOha2rkLvucgmw4xYv73ubmui3eeSIF68ZM,3107
45
45
  tinybird/tb/modules/llm.py,sha256=fPBBCmM3KlCksLlgJkg4joDn6y3H5QjDzE-Pm4YNf7E,1782
46
46
  tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
47
- tinybird/tb/modules/local.py,sha256=L6YWHgzILAwe9s1ZqnP1usjgI1u-Hs9KzxnB5JCdwC0,5837
48
- tinybird/tb/modules/local_common.py,sha256=8cnBh3eoHRV6Ze7Rg9bueF3Zb_wYDe54bm5cGRvrwbY,17596
47
+ tinybird/tb/modules/local.py,sha256=kW3IHwJPvhBsa1eMh_xzow9Az3yYpHthkzsLSHeP5HE,6512
48
+ tinybird/tb/modules/local_common.py,sha256=mFhidxVeGnDA_UHss-bRY8_UzU0V5iZ3HGnVqlnMzY0,17730
49
49
  tinybird/tb/modules/login.py,sha256=zerXZqIv15pbFk5XRt746xGcVnp01YmL_403byBf4jQ,1245
50
50
  tinybird/tb/modules/login_common.py,sha256=IfthYbHmC7EtsCXCB1iF4TngPOwfaHJ6Dfi_t7oBXnI,11640
51
51
  tinybird/tb/modules/logout.py,sha256=sniI4JNxpTrVeRCp0oGJuQ3yRerG4hH5uz6oBmjv724,1009
@@ -69,7 +69,7 @@ tinybird/tb/modules/watch.py,sha256=No0bK1M1_3CYuMaIgylxf7vYFJ72lTJe3brz6xQ-mJo,
69
69
  tinybird/tb/modules/workspace.py,sha256=USsG8YEXlwf7F2PjTMCuQ2lB8ya-erbv8VywNJYq6mc,11173
70
70
  tinybird/tb/modules/workspace_members.py,sha256=5JdkJgfuEwbq-t6vxkBhYwgsiTDxF790wsa6Xfif9nk,8608
71
71
  tinybird/tb/modules/agent/__init__.py,sha256=i3oe3vDIWWPaicdCM0zs7D7BJ1W0k7th93ooskHAV00,54
72
- tinybird/tb/modules/agent/agent.py,sha256=g5jsJ_HHbfR5rn9AoNJdKdkk3fE_2vqBp0kSNMlG46w,33671
72
+ tinybird/tb/modules/agent/agent.py,sha256=TWaYS5od0ns0XKu9UKURdzSmDKxQk-Dm0oxLO8PtLic,33940
73
73
  tinybird/tb/modules/agent/animations.py,sha256=4WOC5_2BracttmMCrV0H91tXfWcUzQHBUaIJc5FA7tE,3490
74
74
  tinybird/tb/modules/agent/banner.py,sha256=l6cO5Fi7lbVKp-GsBP8jf3IkjOWxg2jpAt9NBCy0WR8,4085
75
75
  tinybird/tb/modules/agent/command_agent.py,sha256=Wcdtmo7vJZ5EbBFW9J7zPCME0ShG_KqF6-qHmMB1XXk,3103
@@ -77,7 +77,7 @@ tinybird/tb/modules/agent/compactor.py,sha256=BK5AxZFhrp3xWnsRnYaleiYoIWtVNc-_m6
77
77
  tinybird/tb/modules/agent/explore_agent.py,sha256=HkzKmggfSMz7S3RSeKnZXufq-z_U0tTQJpF7JfNIaGQ,3504
78
78
  tinybird/tb/modules/agent/memory.py,sha256=vBewB_64L_wHoT4tLT6UX2uxcHwSY880QZ26F9rPqXs,3793
79
79
  tinybird/tb/modules/agent/models.py,sha256=IAxqlnHy8c2OeSnDrrSp2Mg38W9_r0GsDM87Wv-YNfM,925
80
- tinybird/tb/modules/agent/prompts.py,sha256=TSzfK255Y6oBSOgy10hVU8TxalhJVcopT27hD4gELQU,37575
80
+ tinybird/tb/modules/agent/prompts.py,sha256=kc_47G9iEyf2p7_C-71Fa5JEwyH2RSYc4vzBHCc1JKE,39971
81
81
  tinybird/tb/modules/agent/testing_agent.py,sha256=AtwtJViH7805i7djyBgDb7SSUtDyJnw0TWJu6lBFsrg,2953
82
82
  tinybird/tb/modules/agent/utils.py,sha256=4jsQCAH2zBx13w20DOBrrDnQq9n2rKG9sGhBkJYiPzs,31744
83
83
  tinybird/tb/modules/agent/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -117,8 +117,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
117
117
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
118
118
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
119
119
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
120
- tinybird-0.0.1.dev280.dist-info/METADATA,sha256=-f88Tb0lj6EhwYrZtnTE2YqLF3u_g_G0KNu2IW8KwqY,1763
121
- tinybird-0.0.1.dev280.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
122
- tinybird-0.0.1.dev280.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
123
- tinybird-0.0.1.dev280.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
124
- tinybird-0.0.1.dev280.dist-info/RECORD,,
120
+ tinybird-0.0.1.dev281.dist-info/METADATA,sha256=addYJX1brd0zshl7fSjLVDq8u-7mtD9ylBkRy0n2GXk,1763
121
+ tinybird-0.0.1.dev281.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
122
+ tinybird-0.0.1.dev281.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
123
+ tinybird-0.0.1.dev281.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
124
+ tinybird-0.0.1.dev281.dist-info/RECORD,,