tinybird 0.0.1.dev284__py3-none-any.whl → 0.0.1.dev286__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.

@@ -419,6 +419,9 @@ class Datafile:
419
419
 
420
420
  def validate(self):
421
421
  if self.kind == DatafileKind.pipe:
422
+ if len(self.nodes) == 0:
423
+ raise DatafileValidationError("Pipe data file must have at least one node")
424
+
422
425
  non_standard_nodes_count = 0
423
426
  for node in self.nodes:
424
427
  node_type = node.get("type", "").lower()
@@ -2007,6 +2010,10 @@ def parse(
2007
2010
  "kafka_ssl_ca_pem": kafka_ssl_ca_pem,
2008
2011
  "kafka_security_protocol": assign_var("kafka_security_protocol"),
2009
2012
  "kafka_sasl_mechanism": assign_var("kafka_sasl_mechanism"),
2013
+ "kafka_sasl_oauthbearer_provider": assign_var("kafka_sasl_oauthbearer_provider"),
2014
+ "kafka_sasl_oauthbearer_aws_region": assign_var("kafka_sasl_oauthbearer_aws_region"),
2015
+ "kafka_sasl_oauthbearer_aws_role_arn": assign_var("kafka_sasl_oauthbearer_aws_role_arn"),
2016
+ "kafka_sasl_oauthbearer_aws_external_id": assign_var("kafka_sasl_oauthbearer_aws_external_id"),
2010
2017
  "kafka_key_avro_deserialization": kafka_key_avro_deserialization_deprecated,
2011
2018
  "s3_region": assign_var("s3_region"),
2012
2019
  "s3_arn": assign_var("s3_arn"),
tinybird/sql.py CHANGED
@@ -907,7 +907,7 @@ def engine_patch_replicated_engine(engine: str, engine_full: Optional[str], new_
907
907
  paths = parts[2].split("/")
908
908
  paths[-1] = new_table_name
909
909
  zoo_path = "/".join(paths)
910
- return "".join(parts[:2] + [zoo_path] + parts[3:])
910
+ return "".join([*parts[:2], zoo_path, *parts[3:]])
911
911
  return engine_full
912
912
 
913
913
 
tinybird/sql_template.py CHANGED
@@ -1411,7 +1411,7 @@ def generate(self, **kwargs) -> Tuple[str, TemplateExecutionResults]:
1411
1411
  if TB_SECRET_IN_TEST_MODE in kwargs:
1412
1412
  template_execution_results[TB_SECRET_IN_TEST_MODE] = None
1413
1413
 
1414
- def set_tb_secret(x):
1414
+ def set_tb_secret(x, default=None):
1415
1415
  try:
1416
1416
  key = secret_template_key(x)
1417
1417
  if key in template_execution_results.template_params:
@@ -1419,8 +1419,10 @@ def generate(self, **kwargs) -> Tuple[str, TemplateExecutionResults]:
1419
1419
  return Symbol("{" + sqlescape(x) + ": String}")
1420
1420
  else:
1421
1421
  is_test_mode = TB_SECRET_IN_TEST_MODE in template_execution_results
1422
- if is_test_mode:
1422
+ if is_test_mode and default is None:
1423
1423
  return Symbol("{" + sqlescape(x) + ": String}")
1424
+ elif default is not None:
1425
+ return default
1424
1426
  else:
1425
1427
  raise SQLTemplateException(
1426
1428
  f"Cannot access secret '{x}'. Check the secret exists in the Workspace and the token has the required scope."
@@ -2266,6 +2268,18 @@ def render_sql_template(
2266
2268
  Traceback (most recent call last):
2267
2269
  ...
2268
2270
  tinybird.sql_template.SQLTemplateException: Template Syntax Error: Cannot access secret 'test'. Check the secret exists in the Workspace and the token has the required scope.
2271
+ >>> render_sql_template("select * from table where str = {{tb_secret('test', 'default_value')}}", secrets = [])
2272
+ ("select * from table where str = 'default_value'", {}, [])
2273
+ >>> render_sql_template("select * from table where str = {{tb_secret('test', 'default_value')}}", secrets = [ 'tb_secret_test' ])
2274
+ ('select * from table where str = {test: String}', {}, [])
2275
+ >>> render_sql_template("select * from table where str = {{tb_secret('test', '')}}")
2276
+ ("select * from table where str = ''", {}, [])
2277
+ >>> render_sql_template("select * from table where str = {{tb_secret('test', 'default_value')}}", test_mode=True)
2278
+ ("select * from table where str = 'default_value'", {}, [])
2279
+ >>> render_sql_template("select * from table where str = {{tb_secret('test', '')}}", test_mode=True)
2280
+ ("select * from table where str = ''", {}, [])
2281
+ >>> render_sql_template("select * from table where str = {{tb_secret('test', 'default_value')}}", secrets = [ 'tb_secret_test' ], test_mode=True)
2282
+ ('select * from table where str = {test: String}', {}, [])
2269
2283
  >>> render_sql_template("select * from table where str = {{String(test)}} and category = {{String(category, 'shirts')}} and color = {{ Int32(color)}}", test_mode=False)
2270
2284
  Traceback (most recent call last):
2271
2285
  ...
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.dev284'
8
- __revision__ = '8beb9ee'
7
+ __version__ = '0.0.1.dev286'
8
+ __revision__ = '3e1e6a3'
@@ -575,6 +575,7 @@ def run_agent(
575
575
  break
576
576
 
577
577
  except Exception as e:
578
+ agent.thinking_animation.stop()
578
579
  click.echo(FeedbackManager.error(message=f"Error: {e}"))
579
580
  sys.exit(1)
580
581
 
@@ -43,10 +43,15 @@ You can run `-h` in every level of the command to get help. E.g. `tb -h`, `tb da
43
43
  When you need to access Tinybird Cloud, add the `--cloud` flag. E.g. `tb --cloud datasource ls`.
44
44
  Available commands:
45
45
  {available_commands}
46
- IMPORTANT: Do NOT use any command that is not in the list above.
47
- IMPORTANT: If you don't have the proper command to solve the task, just answer that you cannot solve the task.
48
46
  Token and host are not required to add to the commands.
49
47
  Always run first help commands to be sure that the commands you are running is not interactive.
48
+ IMPORTANT: Do NOT use any command that is not in the list above.
49
+ IMPORTANT: If you are asked to run a command that is not in the list above, return that you are not able to run that command and needs to use the Tinybird CLI manually and that user should run `tb --help` to get the list of available commands.
50
+ IMPORTANT: If you are not able to run a command, do not recommend any command to be run by the user. Just `tb --help` to get the list of available commands.
51
+ <example_command_not_found>
52
+ User: switch to another workspace
53
+ Assistant: I'm sorry, but I cannot switch to another workspace. You can use the Tinybird CLI to switch workspaces. Run `tb --help` to get the list of available commands.
54
+ </example_command_not_found>
50
55
  """,
51
56
  ],
52
57
  tools=[
@@ -872,6 +872,46 @@ IMPORTANT: Every time you finish a plan and start a new resource creation or upd
872
872
  {datasource_instructions}
873
873
  {datasource_example}
874
874
 
875
+ ## Updating a datasource schema already deployed in Cloud
876
+ If you make changes to a .datasource file that are incompatible with the Cloud version, you must use a forward query to transform the data from the cloud schema to the new one. Otherwise, your deployment fails due to a schema mismatch.
877
+ The `FORWARD_QUERY` instruction is a SELECT query executed on the cloud data source.
878
+ The query must include the column selection part of the query.
879
+ `FROM` and `WHERE` clauses aren't supported.
880
+
881
+ <example_datasource_file_with_forward_query>
882
+ DESCRIPTION >
883
+ Analytics events landing data source
884
+
885
+ SCHEMA >
886
+ `timestamp` DateTime `json:$.timestamp`,
887
+ `session_id` UUID `json:$.session_id`,
888
+ `action` String `json:$.action`,
889
+ `version` String `json:$.version`,
890
+ `payload` String `json:$.payload`
891
+
892
+ ENGINE "MergeTree"
893
+ ENGINE_PARTITION_KEY "toYYYYMM(timestamp)"
894
+ ENGINE_SORTING_KEY "timestamp"
895
+ ENGINE_TTL "timestamp + toIntervalDay(60)"
896
+
897
+ FORWARD_QUERY >
898
+ SELECT timestamp, CAST(session_id, 'UUID') as session_id, action, version, payload
899
+ </example_datasource_file_with_forward_query>
900
+
901
+ Tinybird runs a backfill to migrate the data to the new schema. These backfills are logged in `tinybird.datasources_ops_log` with the `event_type` set to `deployment_backfill`.
902
+ If the existing data is incompatible with the schema change, the staging deployment fails and is discarded. For example, if you change a data type from String to UUID, but the existing da
903
+ If you're willing to accept data loss or default values for incompatible records, you can make the deployment succeed by using the accurateCastOrDefault function in your forward query:
904
+
905
+ ```
906
+ FORWARD_QUERY >
907
+ SELECT timestamp, accurateCastOrDefault(session_id, 'UUID') as session_id, action, version, payload
908
+ ```
909
+ After changes have been deployed and promoted, if you want to deploy other changes that don't affect that data source, you can remove the forward query.
910
+
911
+ <dev_notes>
912
+ If after running a deployment, the error contains a recommended forward query, use it to update the .datasource file.
913
+ </dev_notes>
914
+
875
915
  # Working with any type of pipe file:
876
916
  {pipe_instructions}
877
917
  {pipe_example}
@@ -930,6 +970,7 @@ They can be run on a schedule, or executed on demand.
930
970
  - Use append if user explicitly asks for it
931
971
  - Do not append data if user requests to test an endpoint or call an endpoint.
932
972
  - Do not append data as consequence of an empty response from the endpoint or a query.
973
+ - If the external url provided is not valid or the format is not supported, tell the user to provide a valid remote file url.
933
974
 
934
975
  # How to use `mock` tool:
935
976
  - Use `mock` tool as part of the creation of a new landing datasource if the user did not provided a file or an external url
@@ -157,7 +157,7 @@ def create_workspace(
157
157
  )
158
158
 
159
159
  config = CLIConfig.get_project_config()
160
- user_token = config.get_user_token()
160
+ user_token = get_user_token(config)
161
161
  fork = False
162
162
 
163
163
  if not user_token:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev284
3
+ Version: 0.0.1.dev286
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -21,6 +21,7 @@ Requires-Dist: GitPython~=3.1.32
21
21
  Requires-Dist: humanfriendly~=8.2
22
22
  Requires-Dist: plotext==5.3.2
23
23
  Requires-Dist: prompt_toolkit==3.0.48
24
+ Requires-Dist: logfire-api==4.2.0
24
25
  Requires-Dist: pydantic~=2.11.7
25
26
  Requires-Dist: pydantic-ai-slim[anthropic]~=0.5.0
26
27
  Requires-Dist: pydantic-ai-slim[retries]~=0.5.0
@@ -4,20 +4,20 @@ tinybird/datatypes.py,sha256=r4WCvspmrXTJHiPjjyOTiZyZl31FO3Ynkwq4LQsYm6E,11059
4
4
  tinybird/feedback_manager.py,sha256=XY8d83pRlq-LH7xHMApkaEebfXEWLjDzrGe1prpcTHE,69778
5
5
  tinybird/git_settings.py,sha256=Sw_8rGmribEFJ4Z_6idrVytxpFYk7ez8ei0qHULzs3E,3934
6
6
  tinybird/prompts.py,sha256=HoDv9TxPiP8v2XoGTWYxP133dK9CEbXVv4XE5IT339c,45483
7
- tinybird/sql.py,sha256=BufnOgclQokDyihtuXesOwHBsebN6wRXIxO5wKRkOwE,48299
8
- tinybird/sql_template.py,sha256=OTsBBtGnVL4oUrEEFK19Mi5GHm-BP7v-zViXfPvYqJs,100774
7
+ tinybird/sql.py,sha256=UZJLop6zA9tTPEaS-Fq7M-QyzmC5uV_tIeXZzkjnhso,48299
8
+ tinybird/sql_template.py,sha256=kaF5pi-f2JiWSYXEF8JsU1OIxvdu2homHnw4MYjq0n8,101953
9
9
  tinybird/sql_template_fmt.py,sha256=KUHdj5rYCYm_rKKdXYSJAE9vIyXUQLB0YSZnUXHeBlY,10196
10
10
  tinybird/sql_toolset.py,sha256=19WPr4S3SR--Iw-VPgmDnLmhOZyHhTxnj3-_Yq3OgEU,19767
11
11
  tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
12
12
  tinybird/tornado_template.py,sha256=jjNVDMnkYFWXflmT8KU_Ssbo5vR8KQq3EJMk5vYgXRw,41959
13
13
  tinybird/ch_utils/constants.py,sha256=v5-nkXHUhysu4i9Z4WVv0-sBbh6xSYUH5q5xHSY2xTI,4194
14
14
  tinybird/ch_utils/engine.py,sha256=4X1B-iuhdW_mxKnX_m3iCsxgP9RPVgR75g7yH1vsJ6A,40851
15
- tinybird/datafile/common.py,sha256=uRSQnSS3yv1iuJRZHgenphe-g1TEjZr04ICcl7QYcZw,105521
15
+ tinybird/datafile/common.py,sha256=3aIbSseqHustB7MfnzoOvWL2giQSNn4aJ-52F8RV_wo,106053
16
16
  tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1wnI,556
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=g2YCN8x2pycUNCskVWGzPefjdg8_c5qjgIUIH_fe-dw,247
20
+ tinybird/tb/__cli__.py,sha256=sBAzMXBgl1hlzFEO-dOjfolfF6ZWEOhhnxDURjX9Yb4,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
@@ -66,19 +66,19 @@ tinybird/tb/modules/test.py,sha256=O2-mS4uMU6nPi7yWPpWzshAgOlYKiGS-tkM12pXQGMI,1
66
66
  tinybird/tb/modules/test_common.py,sha256=7EpwGVs3SQTVUOM4fX3iq2fITquYvLtsEz599mN6Eqc,14525
67
67
  tinybird/tb/modules/token.py,sha256=ZhW_o7XCr90wJRhMN6816vyo_TVfnzPXyIhrhzQ7oZ0,13807
68
68
  tinybird/tb/modules/watch.py,sha256=No0bK1M1_3CYuMaIgylxf7vYFJ72lTJe3brz6xQ-mJo,8819
69
- tinybird/tb/modules/workspace.py,sha256=USsG8YEXlwf7F2PjTMCuQ2lB8ya-erbv8VywNJYq6mc,11173
69
+ tinybird/tb/modules/workspace.py,sha256=tCP1zZMwBhLRGm22TGfpSd4cHvQLAS1o_azIXv_r6uw,11172
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=x9nV6NaTqqvcDrg1GvbDleuyajxHbSQ_x7nEHHH2vnk,35207
72
+ tinybird/tb/modules/agent/agent.py,sha256=38X69i7zL93I30hFFMfl6cAwHDgzIO_PP2ImGJF-UDE,35247
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
- tinybird/tb/modules/agent/command_agent.py,sha256=Wcdtmo7vJZ5EbBFW9J7zPCME0ShG_KqF6-qHmMB1XXk,3103
75
+ tinybird/tb/modules/agent/command_agent.py,sha256=0Z08rQsir59zQAr-kkOvsKIFpIBsBSTGJJ1VgqqF5WA,3654
76
76
  tinybird/tb/modules/agent/compactor.py,sha256=BK5AxZFhrp3xWnsRnYaleiYoIWtVNc-_m650Hsopt8g,13841
77
77
  tinybird/tb/modules/agent/explore_agent.py,sha256=W5pp99wixVSyb66qEVwBv8rZWpJ7JgzjJ_sN4d9u4Gg,3903
78
78
  tinybird/tb/modules/agent/memory.py,sha256=vBewB_64L_wHoT4tLT6UX2uxcHwSY880QZ26F9rPqXs,3793
79
79
  tinybird/tb/modules/agent/mock_agent.py,sha256=zbAZfAqdSLUtMr2VqO0erWpzjT2F1tTcuYjvHb-gvbA,8023
80
80
  tinybird/tb/modules/agent/models.py,sha256=eokO8XlY-kVJOsbqiVporGUAOCyKAXCO5xgTEK9SM6Y,2208
81
- tinybird/tb/modules/agent/prompts.py,sha256=kc_47G9iEyf2p7_C-71Fa5JEwyH2RSYc4vzBHCc1JKE,39971
81
+ tinybird/tb/modules/agent/prompts.py,sha256=F49-d_nRd7ai4ikizFHx0_NPGEZ46AgRtUUnxqZhPew,42164
82
82
  tinybird/tb/modules/agent/testing_agent.py,sha256=AtwtJViH7805i7djyBgDb7SSUtDyJnw0TWJu6lBFsrg,2953
83
83
  tinybird/tb/modules/agent/utils.py,sha256=4jsQCAH2zBx13w20DOBrrDnQq9n2rKG9sGhBkJYiPzs,31744
84
84
  tinybird/tb/modules/agent/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -118,8 +118,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
118
118
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
119
119
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
120
120
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
121
- tinybird-0.0.1.dev284.dist-info/METADATA,sha256=wuhdBNroFRewEN3GLUeK5WRSMTH6nXdkibWoT1kLoo8,1811
122
- tinybird-0.0.1.dev284.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
123
- tinybird-0.0.1.dev284.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
124
- tinybird-0.0.1.dev284.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
125
- tinybird-0.0.1.dev284.dist-info/RECORD,,
121
+ tinybird-0.0.1.dev286.dist-info/METADATA,sha256=AgRm7oY7SSB_UAYtlzoAFL6f1_K-S_RPu06Ni6cOfkk,1845
122
+ tinybird-0.0.1.dev286.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
123
+ tinybird-0.0.1.dev286.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
124
+ tinybird-0.0.1.dev286.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
125
+ tinybird-0.0.1.dev286.dist-info/RECORD,,