tinybird 0.0.1.dev305__py3-none-any.whl → 0.0.1.dev306__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.
tinybird/context.py CHANGED
@@ -12,7 +12,6 @@ table_id: ContextVar[str] = ContextVar("table_id")
12
12
  hfi_frequency: ContextVar[float] = ContextVar("hfi_frequency")
13
13
  hfi_frequency_gatherer: ContextVar[float] = ContextVar("hfi_frequency_gatherer")
14
14
  use_gatherer: ContextVar[bool] = ContextVar("use_gatherer")
15
- allow_gatherer_fallback: ContextVar[bool] = ContextVar("allow_gatherer_fallback")
16
15
  gatherer_allow_s3_backup_on_user_errors: ContextVar[bool] = ContextVar("gatherer_allow_s3_backup_on_user_errors")
17
16
  disable_template_security_validation: ContextVar[bool] = ContextVar("disable_template_security_validation")
18
17
  origin: ContextVar[str] = ContextVar("origin")
tinybird/prompts.py CHANGED
@@ -776,6 +776,7 @@ datasource_instructions = """
776
776
  - Use always json paths to define the schema. Example: `user_id` String `json:$.user_id`,
777
777
  - Array columns are supported with a special syntax. Example: `items` Array(String) `json:$.items[:]`
778
778
  - If the datasource is using an S3 or GCS connection, they need to set IMPORT_CONNECTION_NAME, IMPORT_BUCKET_URI and IMPORT_SCHEDULE (GCS @on-demand only, S3 supports @auto too)
779
+ - If the datasource is using a Kafka connection, they need to set KAFKA_CONNECTION_NAME as the name of the .connection file, KAFKA_TOPIC topic_name and KAFKA_GROUP_ID as the group id for the datasource
779
780
  - Unless the user asks for them, do not include ENGINE_PARTITION_KEY and ENGINE_PRIMARY_KEY.
780
781
  - DateTime64 type without precision is not supported. Use DateTime64(3) instead.
781
782
  </datasource_file_instructions>
@@ -455,6 +455,79 @@ def get_tinybird_service_datasources() -> List[Dict[str, Any]]:
455
455
  {"name": "feature", "type": "String"},
456
456
  ],
457
457
  },
458
+ {
459
+ "name": "tinybird.llm_usage",
460
+ "description": "LLM usage metrics from Tinybird AI features including token consumption, costs, and model usage for each request in the workspace.",
461
+ "dateColumn": "start_time",
462
+ "engine": {
463
+ "engine": "MergeTree",
464
+ "sorting_key": "workspace_id, start_time, user_email, request_id",
465
+ "partition_key": "toYYYYMM(start_time)",
466
+ },
467
+ "columns": [
468
+ {"name": "start_time", "type": "DateTime"},
469
+ {"name": "end_time", "type": "DateTime"},
470
+ {"name": "organization_id", "type": "String"},
471
+ {"name": "organization_name", "type": "String"},
472
+ {"name": "workspace_id", "type": "String"},
473
+ {"name": "workspace_name", "type": "String"},
474
+ {"name": "user_email", "type": "String"},
475
+ {"name": "request_id", "type": "String"},
476
+ {"name": "prompt_tokens", "type": "UInt32"},
477
+ {"name": "completion_tokens", "type": "UInt32"},
478
+ {"name": "total_tokens", "type": "UInt32"},
479
+ {"name": "duration", "type": "Float32"},
480
+ {"name": "cost", "type": "Float32"},
481
+ {"name": "origin", "type": "String"},
482
+ {"name": "feature", "type": "String"},
483
+ ],
484
+ },
485
+ {
486
+ "name": "tinybird.query_metrics",
487
+ "description": "Query stats metrics from your workspace.",
488
+ "dateColumn": "event_time",
489
+ "engine": {
490
+ "engine": "ReplacingMergeTree",
491
+ "sorting_key": "event_time, organization_id, query_id",
492
+ "partition_key": "toStartOfDay(event_time)",
493
+ },
494
+ "columns": [
495
+ {"name": "event_time", "type": "DateTime"},
496
+ {"name": "organization_id", "type": "String"},
497
+ {"name": "workspace_id", "type": "String"},
498
+ {"name": "query", "type": "String"},
499
+ {"name": "query_id", "type": "String"},
500
+ {"name": "query_type", "type": "String"},
501
+ {"name": "query_start_time", "type": "DateTime"},
502
+ {"name": "query_duration_ms", "type": "Int32"},
503
+ {"name": "pipe_id", "type": "String"},
504
+ {"name": "job_id", "type": "String"},
505
+ {"name": "job_kind", "type": "String"},
506
+ {"name": "read_rows", "type": "Int32"},
507
+ {"name": "read_bytes", "type": "Int32"},
508
+ {"name": "written_rows", "type": "Int32"},
509
+ {"name": "written_bytes", "type": "Int32"},
510
+ {"name": "memory_usage", "type": "Int32"},
511
+ {"name": "vcpu_time", "type": "Float32"},
512
+ {"name": "exception_code", "type": "Int32"},
513
+ {"name": "exception", "type": "String"},
514
+ ],
515
+ },
516
+ {
517
+ "name": "tinybird.vcpu_time",
518
+ "description": "vCPU time metrics from your workspace.",
519
+ "dateColumn": "minute_slot",
520
+ "engine": {
521
+ "engine": "AggregatingMergeTree",
522
+ "sorting_key": "organization_id, minute_slot",
523
+ "partition_key": "toStartOfDay(minute_slot)",
524
+ },
525
+ "columns": [
526
+ {"name": "minute_slot", "type": "DateTime"},
527
+ {"name": "organization_id", "type": "String"},
528
+ {"name": "vcpu_time", "type": "Float64"},
529
+ ],
530
+ },
458
531
  ]
459
532
 
460
533
 
@@ -935,6 +1008,53 @@ def get_organization_service_datasources() -> List[Dict[str, Any]]:
935
1008
  {"name": "feature", "type": "String"},
936
1009
  ],
937
1010
  },
1011
+ {
1012
+ "name": "organization.query_metrics",
1013
+ "description": "Query stats metrics from your workspace.",
1014
+ "dateColumn": "event_time",
1015
+ "engine": {
1016
+ "engine": "ReplacingMergeTree",
1017
+ "sorting_key": "event_time, organization_id, query_id",
1018
+ "partition_key": "toStartOfDay(event_time)",
1019
+ },
1020
+ "columns": [
1021
+ {"name": "event_time", "type": "DateTime"},
1022
+ {"name": "organization_id", "type": "String"},
1023
+ {"name": "workspace_id", "type": "String"},
1024
+ {"name": "query", "type": "String"},
1025
+ {"name": "query_id", "type": "String"},
1026
+ {"name": "query_type", "type": "String"},
1027
+ {"name": "query_start_time", "type": "DateTime"},
1028
+ {"name": "query_duration_ms", "type": "Int32"},
1029
+ {"name": "pipe_id", "type": "String"},
1030
+ {"name": "job_id", "type": "String"},
1031
+ {"name": "job_kind", "type": "String"},
1032
+ {"name": "read_rows", "type": "Int32"},
1033
+ {"name": "read_bytes", "type": "Int32"},
1034
+ {"name": "written_rows", "type": "Int32"},
1035
+ {"name": "written_bytes", "type": "Int32"},
1036
+ {"name": "memory_usage", "type": "Int32"},
1037
+ {"name": "vcpu_time", "type": "Float32"},
1038
+ {"name": "exception_code", "type": "Int32"},
1039
+ {"name": "exception", "type": "String"},
1040
+ ],
1041
+ },
1042
+ {
1043
+ "name": "organization.vcpu_time",
1044
+ "description": "vCPU time metrics from your workspace.",
1045
+ "dateColumn": "minute_slot",
1046
+ "engine": {
1047
+ "engine": "AggregatingMergeTree",
1048
+ "sorting_key": "organization_id, minute_slot",
1049
+ "partition_key": "toStartOfDay(minute_slot)",
1050
+ },
1051
+ "columns": [
1052
+ {"name": "minute_slot", "type": "DateTime"},
1053
+ {"name": "organization_id", "type": "String"},
1054
+ {"name": "workspace_id", "type": "String"},
1055
+ {"name": "vcpu_time", "type": "Float64"},
1056
+ ],
1057
+ },
938
1058
  ]
939
1059
 
940
1060
 
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.dev305'
8
- __revision__ = 'cc453b3'
7
+ __version__ = '0.0.1.dev306'
8
+ __revision__ = 'dcef65b'
@@ -110,7 +110,7 @@ def cli(
110
110
  prompt: Optional[str] = None,
111
111
  ) -> None:
112
112
  """
113
- Use Tinybird Code to interact with your project.
113
+ Run just `tb` to use Tinybird Code to interact with your project.
114
114
  """
115
115
 
116
116
  # We need to unpatch for our tests not to break
@@ -211,6 +211,13 @@ def cli(
211
211
  is_prompt_mode = prompt is not None
212
212
 
213
213
  if is_agent_mode or is_prompt_mode:
214
+ if any(arg in sys.argv for arg in ["--cloud", "--local"]):
215
+ raise CLIException(
216
+ FeedbackManager.error(
217
+ message="Tinybird Code does not support --cloud or --local flags. It will choose the correct environment based on your prompts."
218
+ )
219
+ )
220
+
214
221
  run_agent(config, project, dangerously_skip_permissions, prompt=prompt)
215
222
 
216
223
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev305
3
+ Version: 0.0.1.dev306
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -1,10 +1,10 @@
1
1
  tinybird/connectors.py,sha256=TSux0opkG3gbzTTyRIUfNk4RJoLvTIyp42rdsmmIAYg,15083
2
- tinybird/context.py,sha256=M2jhaNBDOFLlSU2ONDPwO7Coknh2z1PNY-TlNJAkEK0,1343
2
+ tinybird/context.py,sha256=QNS9yB3i3bQUZMc_Z4oBN_oMDZaBM-Q6g12jNLjNH98,1261
3
3
  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
- tinybird/prompts.py,sha256=HoDv9TxPiP8v2XoGTWYxP133dK9CEbXVv4XE5IT339c,45483
7
- tinybird/service_datasources.py,sha256=y36l2QYLxFEYRBEBuYCKtjkPjGu0P2a8Fz_AjOTTNM4,48914
6
+ tinybird/prompts.py,sha256=F8ic_mGId50MDJmg5ec8i5BDavxz9SWtocLXqgO0IRY,45689
7
+ tinybird/service_datasources.py,sha256=jFjRYbGykd76UcFNX7rry4bdPNDxl4SIbMkMVClyk54,54711
8
8
  tinybird/sql.py,sha256=7pkwQMUVy0CH5zFgLMZyCx1BeaJSQYC05EmOb9vO3Ls,48694
9
9
  tinybird/sql_template.py,sha256=qz1Q-d8jlGpU8w-jcwn_NM4ApFtJAhEL-3_3-JELrl4,102979
10
10
  tinybird/sql_template_fmt.py,sha256=KUHdj5rYCYm_rKKdXYSJAE9vIyXUQLB0YSZnUXHeBlY,10196
@@ -18,7 +18,7 @@ tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1w
18
18
  tinybird/datafile/parse_connection.py,sha256=tRyn2Rpr1TeWet5BXmMoQgaotbGdYep1qiTak_OqC5E,1825
19
19
  tinybird/datafile/parse_datasource.py,sha256=ssW8QeFSgglVFi3sDZj_HgkJiTJ2069v2JgqnH3CkDE,1825
20
20
  tinybird/datafile/parse_pipe.py,sha256=8e9LMecSQVWHC4AXf8cdxoQ1nxUR4fTObYxTctO_EXQ,3816
21
- tinybird/tb/__cli__.py,sha256=KoDxX7t1llHSTiafcOR0AIeehU6WnVkQeNq7EuQ6nuw,247
21
+ tinybird/tb/__cli__.py,sha256=kZpdvL-dPYWUC1OIxl9P1uxd9h4rCOkGdikrpyt0_Us,247
22
22
  tinybird/tb/check_pypi.py,sha256=Gp0HkHHDFMSDL6nxKlOY51z7z1Uv-2LRexNTZSHHGmM,552
23
23
  tinybird/tb/cli.py,sha256=FdDFEIayjmsZEVsVSSvRiVYn_FHOVg_zWQzchnzfWho,1008
24
24
  tinybird/tb/client.py,sha256=Z27O6kXbQ1ZVi_K6qzdUJoS877nt7rqQDRckOycjNmI,53544
@@ -26,7 +26,7 @@ tinybird/tb/config.py,sha256=XIKju3xxpo40oQ48zDtSv0vgUrBZBHSmHJi4SHksjXE,5447
26
26
  tinybird/tb/modules/build.py,sha256=q3f_CM-_yt7R24VCmQqe4yat1aPdLqmP_hW5WoqdxBg,7907
27
27
  tinybird/tb/modules/build_common.py,sha256=zHqnzEdJvEIlzDGEL5HqcUXInuKLqYG6hPCdB6f6PMA,20064
28
28
  tinybird/tb/modules/cicd.py,sha256=0KLKccha9IP749QvlXBmzdWv1On3mFwMY4DUcJlBxiE,7326
29
- tinybird/tb/modules/cli.py,sha256=dkHnD8oiB7w4YllTDOvmE71BU8wSLDEDvkquKqg4s8Y,20479
29
+ tinybird/tb/modules/cli.py,sha256=pjl7537sWw0o8IqnDFqdp9RPvgARnJN0cX2vMPHn9Bg,20816
30
30
  tinybird/tb/modules/common.py,sha256=UkrlPni5jh43w18FOWx3icNbjpAWbB-bgXDWOQPGh3Y,83559
31
31
  tinybird/tb/modules/config.py,sha256=gK7rgaWTDd4ZKCrNEg_Uemr26EQjqWt6TjyQKujxOws,11462
32
32
  tinybird/tb/modules/connection.py,sha256=axp8Fny1_4PSLJGN4UF6WygyRbQtM3Lbt6thxHKTxzw,17790
@@ -121,8 +121,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
121
121
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
122
122
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
123
123
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
124
- tinybird-0.0.1.dev305.dist-info/METADATA,sha256=kf9UMEPqhBrJvZD_DpAjOJ-demRErf4gMk42ifnZ7cQ,1881
125
- tinybird-0.0.1.dev305.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
126
- tinybird-0.0.1.dev305.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
127
- tinybird-0.0.1.dev305.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
128
- tinybird-0.0.1.dev305.dist-info/RECORD,,
124
+ tinybird-0.0.1.dev306.dist-info/METADATA,sha256=7k-rYFZmsHITYe0TZqERa8JdoC4ysCstCKvFEqxiGvA,1881
125
+ tinybird-0.0.1.dev306.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
126
+ tinybird-0.0.1.dev306.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
127
+ tinybird-0.0.1.dev306.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
128
+ tinybird-0.0.1.dev306.dist-info/RECORD,,