tinybird 0.0.1.dev41__py3-none-any.whl → 0.0.1.dev42__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
@@ -371,10 +371,19 @@ You are a Tinybird expert. You will be given a pipe containing different nodes w
371
371
  - The test command must be a valid Tinybird command that can be run in the terminal.
372
372
  - The test command can have as many parameters as are needed to test the pipe.
373
373
  - The parameter within Tinybird templating syntax looks like this one {{String(my_param_name, default_value)}}.
374
- - If there are no parameters, you can omit parameters and generate a single test command.
374
+ - If there are no parameters, you can omit parameters and generate a single test.
375
375
  - The format of the parameters is the following: ?param1=value1&param2=value2&param3=value3
376
376
  </instructions>
377
377
 
378
+ This is an example of a test with parameters:
379
+ <example>
380
+ <test>
381
+ <name>kpis_date_range</name>
382
+ <description>Test specific date range with daily granularity</description>
383
+ <parameters>?date_from=2024-01-01&date_to=2024-01-10</parameters>
384
+ </test>
385
+ </example>
386
+
378
387
  Follow the instructions and generate the following response with no additional text:
379
388
 
380
389
  <response>
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.dev41'
8
- __revision__ = '86b5c65'
7
+ __version__ = '0.0.1.dev42'
8
+ __revision__ = '14b255c'
@@ -36,13 +36,12 @@ def build(ctx: click.Context, watch: bool) -> None:
36
36
 
37
37
  def process(file_changed: Optional[str] = None) -> None:
38
38
  if file_changed and file_changed.endswith(".ndjson"):
39
- rebuild_fixture(project, file_changed)
39
+ rebuild_fixture(project, tb_client, file_changed)
40
40
  else:
41
41
  build_project(project, tb_client)
42
- new_tb_client = asyncio.run(get_tinybird_local_client(str(project.path)))
43
42
  try:
44
43
  if file_changed:
45
- build_and_print_resource(new_tb_client, file_changed)
44
+ build_and_print_resource(tb_client, file_changed)
46
45
  except Exception:
47
46
  pass
48
47
 
@@ -52,7 +51,7 @@ def build(ctx: click.Context, watch: bool) -> None:
52
51
  click.echo(FeedbackManager.success(message=f"\n✓ Build completed in {elapsed_time:.1f}s"))
53
52
 
54
53
  if watch:
55
- shell = Shell(project=project)
54
+ shell = Shell(project=project, tb_client=tb_client)
56
55
  click.echo(FeedbackManager.gray(message="\nWatching for changes..."))
57
56
  watcher_thread = threading.Thread(
58
57
  target=watch_project,
@@ -88,7 +87,7 @@ def build_project(project: Project, tb_client: TinyB) -> None:
88
87
  files.append((MULTIPART_BOUNDARY_DATA_PROJECT, (relative_path, fd.read().decode("utf-8"), content_type)))
89
88
  HEADERS = {"Authorization": f"Bearer {TINYBIRD_API_KEY}"}
90
89
 
91
- r = requests.post(TINYBIRD_API_URL, files=files, headers=HEADERS, data={"folder": str(project_path)})
90
+ r = requests.post(TINYBIRD_API_URL, files=files, headers=HEADERS)
92
91
  try:
93
92
  result = r.json()
94
93
  except Exception as e:
@@ -115,7 +114,6 @@ def build_project(project: Project, tb_client: TinyB) -> None:
115
114
  click.echo(FeedbackManager.info(message=f"✓ {pipe_path} created"))
116
115
 
117
116
  try:
118
- new_tb_client = asyncio.run(get_tinybird_local_client(str(project.path)))
119
117
  for filename in project_files:
120
118
  if filename.endswith(".datasource"):
121
119
  ds_path = Path(filename)
@@ -128,7 +126,7 @@ def build_project(project: Project, tb_client: TinyB) -> None:
128
126
  fixture_path = fixture_folder / f"{ds_name}.ndjson"
129
127
 
130
128
  if fixture_path.exists():
131
- append_fixture(new_tb_client, ds_name, str(fixture_path))
129
+ append_fixture(tb_client, ds_name, str(fixture_path))
132
130
  except Exception:
133
131
  pass
134
132
 
@@ -166,9 +164,8 @@ def append_fixture(
166
164
  )
167
165
 
168
166
 
169
- def rebuild_fixture(project: Project, fixture: str) -> None:
167
+ def rebuild_fixture(project: Project, tb_client: TinyB, fixture: str) -> None:
170
168
  try:
171
- tb_client = asyncio.run(get_tinybird_local_client(str(project.path)))
172
169
  fixture_path = Path(fixture)
173
170
  datasources_path = Path(project.folder) / "datasources"
174
171
  ds_name = fixture_path.stem
@@ -14,9 +14,9 @@ from prompt_toolkit.key_binding import KeyBindings
14
14
  from prompt_toolkit.shortcuts import CompleteStyle
15
15
  from prompt_toolkit.styles import Style
16
16
 
17
+ from tinybird.client import TinyB
17
18
  from tinybird.tb.modules.exceptions import CLIException
18
19
  from tinybird.tb.modules.feedback_manager import FeedbackManager, bcolors
19
- from tinybird.tb.modules.local_common import get_tinybird_local_client
20
20
  from tinybird.tb.modules.project import Project
21
21
  from tinybird.tb.modules.table import format_table
22
22
 
@@ -174,9 +174,10 @@ def _(event):
174
174
 
175
175
 
176
176
  class Shell:
177
- def __init__(self, project: Project):
177
+ def __init__(self, project: Project, tb_client: TinyB):
178
178
  self.history = self.get_history()
179
179
  self.project = project
180
+ self.tb_client = tb_client
180
181
  self.prompt_message = "\ntb > "
181
182
  self.commands = ["create", "mock", "test", "tb", "select"]
182
183
  self.session: PromptSession = PromptSession(
@@ -285,9 +286,8 @@ class Shell:
285
286
  loop = asyncio.new_event_loop()
286
287
  asyncio.set_event_loop(loop)
287
288
  try:
288
- tb_client = asyncio.run(get_tinybird_local_client(str(self.project.path)))
289
289
  return loop.run_until_complete(
290
- tb_client.query(f"SELECT * FROM ({query}) LIMIT {rows_limit} FORMAT JSON")
290
+ self.tb_client.query(f"SELECT * FROM ({query}) LIMIT {rows_limit} FORMAT JSON")
291
291
  )
292
292
  finally:
293
293
  loop.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird
3
- Version: 0.0.1.dev41
3
+ Version: 0.0.1.dev42
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=A3GBApac9xO6hrAMJ1s9dMrI_ou9aKF84CdEjtPddMk,1417
6
6
  tinybird/datatypes.py,sha256=XNypumfqNjsvLJ5iNXnbVHRvAJe0aQwI3lS6Cxox-e0,10979
7
7
  tinybird/feedback_manager.py,sha256=ON5Zu-G3-QDVfH2i_P-V4EtyhlNtAzyp1YDZsnce0_U,67826
8
8
  tinybird/git_settings.py,sha256=Sw_8rGmribEFJ4Z_6idrVytxpFYk7ez8ei0qHULzs3E,3934
9
- tinybird/prompts.py,sha256=2UdLOCjIWbLINI1TuUSDXOW2T0YaPD0RHZAa26j6VlE,25247
9
+ tinybird/prompts.py,sha256=WC2tw8Wj_nWU8EahpGjPRU1_zHJFD_NYOxNBkyNSrLI,25524
10
10
  tinybird/sql.py,sha256=eulpRe05ZFrKFrxYawgxDxxrktFE8uL6hSL1gHIWKyg,46166
11
11
  tinybird/sql_template.py,sha256=GmMLAI10MTqjQo9qztuQHLRWs67teozsWDxUBdvkAn4,93668
12
12
  tinybird/sql_template_fmt.py,sha256=1z-PuqSZXtzso8Z_mPqUc-NxIxUrNUcVIPezNieZk-M,10196
@@ -15,10 +15,10 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
15
15
  tinybird/tornado_template.py,sha256=oflXyoL2LSCegvl6bAzqw2JIqRaN5WPjhYYDtQcfuOE,41869
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=Py43Okm6MRi1REBHdZBS-rEI97DI49FulIJwEZXDzhs,251
18
+ tinybird/tb/__cli__.py,sha256=aEh-MDqP_iIIfd6_rVSGLlON036qY8cP3tgDqvymcIc,251
19
19
  tinybird/tb/cli.py,sha256=_kYDnDS3a45MMKJFZnYZx1gLuVqs4N_Rt8GO4sueAeg,957
20
20
  tinybird/tb/modules/auth.py,sha256=EzRWFmwRkXNhUmRaruEVFLdkbUg8xMSix0cAWl5D4Jg,9029
21
- tinybird/tb/modules/build.py,sha256=N1I_MWPChBdfrFMcHdIbsTbMrGSNDBPBmhv2xSLsoWw,7500
21
+ tinybird/tb/modules/build.py,sha256=TMf05fJw3OrARiU1SyfOe_JChCwpJhCOf42R1JLtzNw,7252
22
22
  tinybird/tb/modules/build_client.py,sha256=na4MH0D4_yXMkNEW2a9bslW6t1fBRnr8JTN68MfRvvw,7229
23
23
  tinybird/tb/modules/cicd.py,sha256=SjCyvvy0WUnsjFs2biwwXvcf0Ddpmghhd8-SnMyfsRM,5355
24
24
  tinybird/tb/modules/cli.py,sha256=hD_mUAXtUofU20UC9j8Pzc4QI1gV0Y9Zefwe24T-qZA,19427
@@ -42,7 +42,7 @@ tinybird/tb/modules/mock.py,sha256=XoCaFFroJf2jWVxEztPelwXYNle__KilON1e81Mxkd4,3
42
42
  tinybird/tb/modules/pipe.py,sha256=Kay7AZVf_M5biIvX5hi-Vaz4l9C7AV-s0C2Nle_gkJo,17528
43
43
  tinybird/tb/modules/project.py,sha256=EyrX5-5i3vhWk6v3KzbrZg8im4ey23hpzM7U651u6OE,1432
44
44
  tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
45
- tinybird/tb/modules/shell.py,sha256=ycovF7PQLpzy27qYp_IsP6KO8LZMO5hnex3INMhtebM,13068
45
+ tinybird/tb/modules/shell.py,sha256=iCX9HsvNhVDecop-s4zDPjXfL9GQ56-QODqwHsN5oT8,12994
46
46
  tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
47
47
  tinybird/tb/modules/tag.py,sha256=anPmMUBc-TbFovlpFi8GPkKA18y7Y0GczMsMms5TZsU,3502
48
48
  tinybird/tb/modules/telemetry.py,sha256=iEGnMuCuNhvF6ln__j6X9MSTwL_0Hm-GgFHHHvhfknk,10466
@@ -75,8 +75,8 @@ tinybird/tb_cli_modules/config.py,sha256=6u6B5QCdiQLbJkCkwtnKGs9H3nP-KXXhC75mF7B
75
75
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
76
76
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
77
77
  tinybird/tb_cli_modules/telemetry.py,sha256=iEGnMuCuNhvF6ln__j6X9MSTwL_0Hm-GgFHHHvhfknk,10466
78
- tinybird-0.0.1.dev41.dist-info/METADATA,sha256=VrfRatTvL5BvgKELZsK-vEW6vu_4_5cbWnWf7Penawo,2482
79
- tinybird-0.0.1.dev41.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
80
- tinybird-0.0.1.dev41.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
81
- tinybird-0.0.1.dev41.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
82
- tinybird-0.0.1.dev41.dist-info/RECORD,,
78
+ tinybird-0.0.1.dev42.dist-info/METADATA,sha256=FSUPwdWAtuJLEQKMOrVavA9rSrSikd6sYUjBHttCUCY,2482
79
+ tinybird-0.0.1.dev42.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
80
+ tinybird-0.0.1.dev42.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
81
+ tinybird-0.0.1.dev42.dist-info/top_level.txt,sha256=pgw6AzERHBcW3YTi2PW4arjxLkulk2msOz_SomfOEuc,45
82
+ tinybird-0.0.1.dev42.dist-info/RECORD,,