tinybird 0.0.1.dev106__py3-none-any.whl → 0.0.1.dev108__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/prompts.py CHANGED
@@ -605,8 +605,9 @@ Follow the instructions and generate the following response with no additional t
605
605
  copy_pipe_instructions = """
606
606
  <copy_pipe_instructions>
607
607
  - Do not create copy pipes by default, unless the user asks for it.
608
+ - Copy pipes should be created in the /copies folder.
608
609
  - In a .pipe file you can define how to export the result of a Pipe to a Data Source, optionally with a schedule.
609
- - Do not include COPY_SCHEDULE in the .pipe file if it is not requested by the user.
610
+ - Do not include COPY_SCHEDULE in the .pipe file unless is specifically requested by the user.
610
611
  - COPY_SCHEDULE is a cron expression that defines the schedule of the copy pipe.
611
612
  - COPY_SCHEDULE is optional and if not provided, the copy pipe will be executed only once.
612
613
  - TARGET_DATASOURCE is the name of the Data Source to export the result to.
@@ -634,6 +635,7 @@ COPY_SCHEDULE 0 * * * *
634
635
  materialized_pipe_instructions = """
635
636
  <materialized_pipe_instructions>
636
637
  - Do not create materialized pipes by default, unless the user asks for it.
638
+ - Materialized pipes should be created in the /materializations folder.
637
639
  - In a .pipe file you can define how to materialize each row ingested in the earliest Data Source in the Pipe query to a materialized Data Source. Materialization happens at ingest.
638
640
  - DATASOURCE: Required when TYPE is MATERIALIZED. Sets the target Data Source for materialized nodes.
639
641
  - TYPE MATERIALIZED is the type of the pipe and it is mandatory for materialized pipes.
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.dev106'
8
- __revision__ = 'b74e464'
7
+ __version__ = '0.0.1.dev108'
8
+ __revision__ = '1909c2e'
@@ -58,6 +58,33 @@ jobs:
58
58
  run: tb --cloud --host ${{! env.TINYBIRD_HOST }} --token ${{! env.TINYBIRD_TOKEN }} deploy --check
59
59
  """
60
60
 
61
+ GITHUB_CD_YML = """
62
+ name: Tinybird - CD Workflow
63
+
64
+ on:
65
+ push:
66
+ branches:
67
+ - main
68
+ - master{% if data_project_dir != '.' %}
69
+ paths:
70
+ - '{{ data_project_dir }}/**'{% end %}
71
+
72
+ concurrency: ${{! github.workflow }}-${{! github.event.ref }}
73
+
74
+ env:
75
+ TINYBIRD_HOST: ${{! secrets.TINYBIRD_HOST }}
76
+ TINYBIRD_TOKEN: ${{! secrets.TINYBIRD_TOKEN }}
77
+
78
+ jobs:
79
+ cd:
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - uses: actions/checkout@v3
83
+ - name: Install Tinybird CLI
84
+ run: curl -LsSf https://api.tinybird.co/static/install.sh | sh
85
+ - name: Deploy project
86
+ run: tb --cloud --host ${{! env.TINYBIRD_HOST }} --token ${{! env.TINYBIRD_TOKEN }} deploy
87
+ """
61
88
 
62
89
  GITLAB_YML = """
63
90
  include:
@@ -65,6 +92,7 @@ include:
65
92
 
66
93
  stages:
67
94
  - tests
95
+ - deploy
68
96
  """
69
97
 
70
98
 
@@ -92,6 +120,22 @@ tinybird_ci_workflow:
92
120
  services:
93
121
  - name: tinybirdco/tinybird-local:beta
94
122
  alias: tinybird-local
123
+
124
+ tinybird_cd_workflow:
125
+ image: ubuntu:latest
126
+ stage: deploy
127
+ resource_group: production
128
+ needs: []
129
+ rules:
130
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
131
+ changes:
132
+ - .gitlab/tinybird/*{% if data_project_dir != '.' %}
133
+ - {{ data_project_dir }}/*
134
+ - {{ data_project_dir }}/**/*{% end %}
135
+ script:
136
+ - export PATH="$HOME/.local/bin:$PATH"
137
+ - cd $CI_PROJECT_DIR/{{ data_project_dir }}
138
+ - tb --cloud --host ${{! TINYBIRD_HOST }} --token ${{! TINYBIRD_TOKEN }} deploy
95
139
  """
96
140
 
97
141
 
@@ -153,6 +197,11 @@ class GitHubCICDGenerator(CICDGeneratorBase):
153
197
  file_name="tinybird-ci.yml",
154
198
  dir_path=".github/workflows",
155
199
  ),
200
+ CICDFile(
201
+ template=GITHUB_CD_YML,
202
+ file_name="tinybird-cd.yml",
203
+ dir_path=".github/workflows",
204
+ ),
156
205
  ]
157
206
 
158
207
 
@@ -1,4 +1,3 @@
1
- import os
2
1
  import re
3
2
  import subprocess
4
3
  import time
@@ -7,6 +6,7 @@ import boto3
7
6
  import click
8
7
 
9
8
  import docker
9
+ from docker.client import DockerClient
10
10
  from tinybird.tb.modules.cli import cli
11
11
  from tinybird.tb.modules.common import coro
12
12
  from tinybird.tb.modules.exceptions import CLIException
@@ -15,8 +15,9 @@ from tinybird.tb.modules.local_common import TB_CONTAINER_NAME, TB_IMAGE_NAME, T
15
15
 
16
16
 
17
17
  def start_tinybird_local(
18
- docker_client,
19
- ):
18
+ docker_client: DockerClient,
19
+ use_aws_creds: bool,
20
+ ) -> None:
20
21
  """Start the Tinybird container."""
21
22
  pull_show_prompt = False
22
23
  pull_required = False
@@ -52,13 +53,13 @@ def start_tinybird_local(
52
53
  if container:
53
54
  container.remove(force=True)
54
55
 
55
- environment = get_local_aws_credentials()
56
+ environment = get_use_aws_creds() if use_aws_creds else {}
56
57
 
57
58
  container = docker_client.containers.run(
58
59
  TB_IMAGE_NAME,
59
60
  name=TB_CONTAINER_NAME,
60
61
  detach=True,
61
- ports={"80/tcp": TB_LOCAL_PORT},
62
+ ports={"7181/tcp": TB_LOCAL_PORT},
62
63
  remove=False,
63
64
  platform="linux/amd64",
64
65
  environment=environment,
@@ -81,7 +82,7 @@ def start_tinybird_local(
81
82
  image.remove(force=True)
82
83
 
83
84
 
84
- def get_docker_client():
85
+ def get_docker_client() -> DockerClient:
85
86
  """Check if Docker is installed and running."""
86
87
  try:
87
88
  client = docker.from_env() # type: ignore
@@ -93,7 +94,7 @@ def get_docker_client():
93
94
  )
94
95
 
95
96
 
96
- def get_local_aws_credentials():
97
+ def get_use_aws_creds():
97
98
  credentials: dict[str, str] = {}
98
99
  try:
99
100
  # Get the boto3 session and credentials
@@ -132,21 +133,36 @@ def remove_tinybird_local(docker_client):
132
133
  """Remove the Tinybird container."""
133
134
  try:
134
135
  container = docker_client.containers.get(TB_CONTAINER_NAME)
135
- container.remove(force=True)
136
+ if click.confirm(
137
+ FeedbackManager.warning(
138
+ message="△ This step will remove all your data inside Tinybird Local. Are you sure? [y/N]:"
139
+ ),
140
+ show_default=False,
141
+ prompt_suffix="",
142
+ ):
143
+ container.remove(force=True)
136
144
  except Exception:
137
145
  pass
138
146
 
139
147
 
140
148
  def update_cli():
141
149
  click.echo(FeedbackManager.highlight(message="» Updating Tinybird CLI..."))
142
- process = subprocess.Popen(
143
- [f"{os.getenv('HOME')}/.local/bin/uv", "tool", "upgrade", "tinybird"],
144
- stdout=subprocess.PIPE,
145
- stderr=subprocess.PIPE,
146
- text=True,
147
- )
150
+
151
+ try:
152
+ process = subprocess.Popen(
153
+ ["uv", "tool", "upgrade", "tinybird"],
154
+ stdout=subprocess.PIPE,
155
+ stderr=subprocess.PIPE,
156
+ text=True,
157
+ )
158
+ except FileNotFoundError:
159
+ raise CLIException("Cannot find required tool: uv. Reinstall using: curl -LsSf tbrd.co/fwd | sh")
160
+
148
161
  stdout, stderr = process.communicate()
149
162
  if "Nothing to upgrade" not in stdout + stderr:
163
+ for line in stdout.split("\n") + stderr.split("\n"):
164
+ if "Updated tinybird" in line:
165
+ click.echo(FeedbackManager.info(message=f"» {line}"))
150
166
  click.echo(FeedbackManager.success(message="✓ Tinybird CLI updated"))
151
167
  else:
152
168
  click.echo(FeedbackManager.info(message="✓ Tinybird CLI is already up-to-date"))
@@ -192,21 +208,23 @@ async def remove() -> None:
192
208
 
193
209
  @local.command()
194
210
  @coro
195
- async def start() -> None:
211
+ @click.option("--use-aws-creds", default=False, is_flag=True, help="Use local AWS credentials")
212
+ async def start(use_aws_creds: bool) -> None:
196
213
  """Start Tinybird Local"""
197
214
  click.echo(FeedbackManager.highlight(message="» Starting Tinybird Local..."))
198
215
  docker_client = get_docker_client()
199
- start_tinybird_local(docker_client)
216
+ start_tinybird_local(docker_client, use_aws_creds)
200
217
  click.echo(FeedbackManager.success(message="✓ Tinybird Local is ready!"))
201
218
 
202
219
 
203
220
  @local.command()
204
221
  @coro
205
- async def restart() -> None:
222
+ @click.option("--use-aws-creds", is_flag=True, help="Use local AWS credentials")
223
+ async def restart(use_aws_creds: bool) -> None:
206
224
  """Restart Tinybird Local"""
207
225
  click.echo(FeedbackManager.highlight(message="» Restarting Tinybird Local..."))
208
226
  docker_client = get_docker_client()
209
227
  remove_tinybird_local(docker_client)
210
228
  click.echo(FeedbackManager.info(message="✓ Tinybird Local stopped"))
211
- start_tinybird_local(docker_client)
229
+ start_tinybird_local(docker_client, use_aws_creds)
212
230
  click.echo(FeedbackManager.success(message="✓ Tinybird Local is ready!"))
@@ -99,7 +99,7 @@ def start_server(auth_callback, auth_host):
99
99
  @click.option(
100
100
  "--host",
101
101
  default="https://api.europe-west2.gcp.tinybird.co",
102
- help="Set custom host if it's different than https://api.tinybird.co. See https://www.tinybird.co/docs/api-reference/overview#regions-and-endpoints for the available list of regions.",
102
+ help="Set custom host if it's different than https://api.europe-west2.gcp.tinybird.co. See https://www.tinybird.co/docs/api-reference/overview#regions-and-endpoints for the available list of regions.",
103
103
  )
104
104
  @click.option(
105
105
  "--auth-host",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev106
3
+ Version: 0.0.1.dev108
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -6,7 +6,7 @@ tinybird/context.py,sha256=FfqYfrGX_I7PKGTQo93utaKPDNVYWelg4Hsp3evX5wM,1291
6
6
  tinybird/datatypes.py,sha256=XNypumfqNjsvLJ5iNXnbVHRvAJe0aQwI3lS6Cxox-e0,10979
7
7
  tinybird/feedback_manager.py,sha256=a_ZhFX2zcB7vRknIcmHKMdQbb0c7TqlTBQ_5hPuWh88,69267
8
8
  tinybird/git_settings.py,sha256=Sw_8rGmribEFJ4Z_6idrVytxpFYk7ez8ei0qHULzs3E,3934
9
- tinybird/prompts.py,sha256=RgV1B7-b6-1xXStNlhKikYSCG1WNaddDVeSp8hSgBlE,33753
9
+ tinybird/prompts.py,sha256=0i4Bzg-60lV6NlrQ1Vu6NZ_2we3GqV3rExu77YfA0V4,33889
10
10
  tinybird/sql.py,sha256=J35bhdpuu84HW2tiLp-cs_nzkRwPhiy1yPcFhcWMCR4,46248
11
11
  tinybird/sql_template.py,sha256=mK0yeRFctbXTAu0VNMjIzoFBJoh9PoniAVgEatA5SG4,99832
12
12
  tinybird/sql_template_fmt.py,sha256=KUHdj5rYCYm_rKKdXYSJAE9vIyXUQLB0YSZnUXHeBlY,10196
@@ -15,11 +15,11 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
15
15
  tinybird/tornado_template.py,sha256=jjNVDMnkYFWXflmT8KU_Ssbo5vR8KQq3EJMk5vYgXRw,41959
16
16
  tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
17
17
  tinybird/ch_utils/engine.py,sha256=BZuPM7MFS7vaEKK5tOMR2bwSAgJudPrJt27uVEwZmTY,40512
18
- tinybird/tb/__cli__.py,sha256=-x9kfqwYfco3Vd-oAPM_DWRKixxywipjPTrGaNSIsOE,252
18
+ tinybird/tb/__cli__.py,sha256=OSNR6WHHR8BSY9FOJAY3RW4JLaPIKXViXTAQ-ptYsYg,252
19
19
  tinybird/tb/cli.py,sha256=H_HaZhkimKgkryYXpBjHfY9Qtg-ZORiONU3psDNpzDk,1135
20
20
  tinybird/tb/modules/auth.py,sha256=L1IatO2arRSzys3t8px8xVt8uPWUL5EVD0sFzAV_uVU,9022
21
21
  tinybird/tb/modules/build.py,sha256=h5drdmDFX8NHts9dA2Zepao7KSgMAl3DZGyFufVZP78,11085
22
- tinybird/tb/modules/cicd.py,sha256=cCq2NaW_YYlODoJLQGJE1cPNrHGgOqRP6Jkq554h3f8,5679
22
+ tinybird/tb/modules/cicd.py,sha256=F0hQw-TExU9W3NpUSY-msNZ4tlaPeTXjRDpFZ2B2STU,7023
23
23
  tinybird/tb/modules/cli.py,sha256=XtdwMI5uPoKfhlpSuCuhzODRJfTCx1oXHz_bn3x1OBg,16047
24
24
  tinybird/tb/modules/common.py,sha256=6AmvMe8Uj-5A46aUlM3wJg7AilkJEAmHt1hTOb5IH2w,82957
25
25
  tinybird/tb/modules/config.py,sha256=FqdLpLaKpYubqw3xkB4EX06ufZYDgGRxONR_9i-y-KE,11416
@@ -36,9 +36,9 @@ tinybird/tb/modules/infra.py,sha256=GA5xnYLlVItPfJu_3_5NIdHQDuyfk2Z71wtcn9NncGA,
36
36
  tinybird/tb/modules/job.py,sha256=956Pj8BEEsiD2GZsV9RKKVM3I_CveOLgS82lykO5ukk,2963
37
37
  tinybird/tb/modules/llm.py,sha256=AC0VSphTOM2t-v1_3NLvNN_FIbgMo4dTyMqIv5nniPo,835
38
38
  tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
39
- tinybird/tb/modules/local.py,sha256=SS13uDtH6xhhE9fseQH5cGtHWw9nsrMF1gD5wkGEVcw,6936
39
+ tinybird/tb/modules/local.py,sha256=4BhxfkSTHpckXmH4aU_BothlV5n4JyAIoBKX3wP_BZg,7863
40
40
  tinybird/tb/modules/local_common.py,sha256=RN5OEncHdq7ua4AZ--WgKtaFuEsLvIhq_ROHJadRXXA,3188
41
- tinybird/tb/modules/login.py,sha256=dAaBBn_ZIQRm9BFl6Uw_HgZa2qoLuAO6mBOxob_17ms,6253
41
+ tinybird/tb/modules/login.py,sha256=98b7obc1yQtDtoB-88yyEj_X99ZvVRB13q261AMKJBM,6270
42
42
  tinybird/tb/modules/logout.py,sha256=ULooy1cDBD02-r7voZmhV7udA0ML5tVuflJyShrh56Y,1022
43
43
  tinybird/tb/modules/materialization.py,sha256=r8Q9HXcYEmfrEzP4WpiasCKDJdSkTPaAKJtZMoJKhi8,5749
44
44
  tinybird/tb/modules/mock.py,sha256=2E26N8TMK1sP7eRc9N1nODdc_vU1jBeGRs8e-fbQ5Dc,4516
@@ -81,8 +81,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
81
81
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
82
82
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
83
83
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
84
- tinybird-0.0.1.dev106.dist-info/METADATA,sha256=zlATEfmvwT16raAdYH0EMD0tTCErNZUVgDmYAQYqNd4,1612
85
- tinybird-0.0.1.dev106.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
86
- tinybird-0.0.1.dev106.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
87
- tinybird-0.0.1.dev106.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
88
- tinybird-0.0.1.dev106.dist-info/RECORD,,
84
+ tinybird-0.0.1.dev108.dist-info/METADATA,sha256=gXcf738MA5OAGkVcougBzsBLqsPi-1fff5sNv6bAjGU,1612
85
+ tinybird-0.0.1.dev108.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
86
+ tinybird-0.0.1.dev108.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
87
+ tinybird-0.0.1.dev108.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
88
+ tinybird-0.0.1.dev108.dist-info/RECORD,,