tinybird 0.0.1.dev283__py3-none-any.whl → 0.0.1.dev285__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/ch_utils/constants.py +1 -0
- tinybird/sql.py +1 -1
- tinybird/tb/__cli__.py +2 -2
- tinybird/tb/modules/agent/agent.py +10 -11
- tinybird/tb/modules/agent/command_agent.py +7 -2
- tinybird/tb/modules/agent/prompts.py +41 -0
- {tinybird-0.0.1.dev283.dist-info → tinybird-0.0.1.dev285.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev283.dist-info → tinybird-0.0.1.dev285.dist-info}/RECORD +11 -11
- {tinybird-0.0.1.dev283.dist-info → tinybird-0.0.1.dev285.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev283.dist-info → tinybird-0.0.1.dev285.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev283.dist-info → tinybird-0.0.1.dev285.dist-info}/top_level.txt +0 -0
tinybird/ch_utils/constants.py
CHANGED
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]
|
|
910
|
+
return "".join([*parts[:2], zoo_path, *parts[3:]])
|
|
911
911
|
return engine_full
|
|
912
912
|
|
|
913
913
|
|
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.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev285'
|
|
8
|
+
__revision__ = '0a30a28'
|
|
@@ -383,20 +383,18 @@ class TinybirdAgent:
|
|
|
383
383
|
workspace_id = config.get("id", "")
|
|
384
384
|
workspace = client.workspace(workspace_id, with_organization=True, version="v1")
|
|
385
385
|
limits_data = client.organization_limits(workspace["organization"]["id"])
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
if not
|
|
386
|
+
ai_credits_limits = limits_data.get("limits", {}).get("ai_credits", {})
|
|
387
|
+
current_ai_credits = ai_credits_limits.get("quantity") or 0
|
|
388
|
+
ai_credits = ai_credits_limits.get("max") or 0
|
|
389
|
+
remaining_credits = max(ai_credits - current_ai_credits, 0)
|
|
390
|
+
current_ai_credits = min(ai_credits, current_ai_credits)
|
|
391
|
+
if not ai_credits:
|
|
392
392
|
return
|
|
393
|
-
warning_threshold =
|
|
394
|
-
message_color =
|
|
395
|
-
FeedbackManager.warning if current_ai_requests >= warning_threshold else FeedbackManager.gray
|
|
396
|
-
)
|
|
393
|
+
warning_threshold = ai_credits * 0.8
|
|
394
|
+
message_color = FeedbackManager.warning if current_ai_credits >= warning_threshold else FeedbackManager.gray
|
|
397
395
|
click.echo(
|
|
398
396
|
message_color(
|
|
399
|
-
message=f"{
|
|
397
|
+
message=f"{remaining_credits} credits left ({current_ai_credits}/{ai_credits}). You can continue using Tinybird Code. Limits will be enforced soon."
|
|
400
398
|
)
|
|
401
399
|
)
|
|
402
400
|
except Exception:
|
|
@@ -577,6 +575,7 @@ def run_agent(
|
|
|
577
575
|
break
|
|
578
576
|
|
|
579
577
|
except Exception as e:
|
|
578
|
+
agent.thinking_animation.stop()
|
|
580
579
|
click.echo(FeedbackManager.error(message=f"Error: {e}"))
|
|
581
580
|
sys.exit(1)
|
|
582
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
|
|
@@ -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=
|
|
7
|
+
tinybird/sql.py,sha256=UZJLop6zA9tTPEaS-Fq7M-QyzmC5uV_tIeXZzkjnhso,48299
|
|
8
8
|
tinybird/sql_template.py,sha256=OTsBBtGnVL4oUrEEFK19Mi5GHm-BP7v-zViXfPvYqJs,100774
|
|
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
|
-
tinybird/ch_utils/constants.py,sha256=
|
|
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
15
|
tinybird/datafile/common.py,sha256=uRSQnSS3yv1iuJRZHgenphe-g1TEjZr04ICcl7QYcZw,105521
|
|
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=
|
|
20
|
+
tinybird/tb/__cli__.py,sha256=8Avu_3xqfp0OfVOmQW7sJg4dwrhj1I6b2-pLutdFn8w,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
|
|
@@ -69,16 +69,16 @@ 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=
|
|
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=
|
|
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=
|
|
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.
|
|
122
|
-
tinybird-0.0.1.
|
|
123
|
-
tinybird-0.0.1.
|
|
124
|
-
tinybird-0.0.1.
|
|
125
|
-
tinybird-0.0.1.
|
|
121
|
+
tinybird-0.0.1.dev285.dist-info/METADATA,sha256=TSthFD5eA-D8BSU0WggS9U102dd9NAOg4m8COH4jClc,1811
|
|
122
|
+
tinybird-0.0.1.dev285.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
123
|
+
tinybird-0.0.1.dev285.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
124
|
+
tinybird-0.0.1.dev285.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
125
|
+
tinybird-0.0.1.dev285.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|