tinybird 0.0.1.dev216__tar.gz → 0.0.1.dev220__tar.gz

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.

Files changed (111) hide show
  1. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/PKG-INFO +1 -1
  2. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/ch_utils/constants.py +13 -0
  3. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/datafile/common.py +2 -0
  4. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/prompts.py +39 -35
  5. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/__cli__.py +2 -2
  6. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/cli.py +9 -0
  7. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/create.py +1 -1
  8. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/local.py +7 -1
  9. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/workspace.py +18 -7
  10. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird.egg-info/PKG-INFO +1 -1
  11. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/setup.cfg +0 -0
  12. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/__cli__.py +0 -0
  13. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/ch_utils/engine.py +0 -0
  14. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/check_pypi.py +0 -0
  15. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/client.py +0 -0
  16. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/config.py +0 -0
  17. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/connectors.py +0 -0
  18. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/context.py +0 -0
  19. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/datafile/exceptions.py +0 -0
  20. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/datafile/parse_connection.py +0 -0
  21. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/datafile/parse_datasource.py +0 -0
  22. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/datafile/parse_pipe.py +0 -0
  23. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/datatypes.py +0 -0
  24. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/feedback_manager.py +0 -0
  25. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/git_settings.py +0 -0
  26. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/sql.py +0 -0
  27. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/sql_template.py +0 -0
  28. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/sql_template_fmt.py +0 -0
  29. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/sql_toolset.py +0 -0
  30. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/syncasync.py +0 -0
  31. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/check_pypi.py +0 -0
  32. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/cli.py +0 -0
  33. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/client.py +0 -0
  34. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/config.py +0 -0
  35. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/build.py +0 -0
  36. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/cicd.py +0 -0
  37. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/common.py +0 -0
  38. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/config.py +0 -0
  39. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/connection.py +0 -0
  40. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/copy.py +0 -0
  41. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/build.py +0 -0
  42. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/build_common.py +0 -0
  43. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
  44. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
  45. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/diff.py +0 -0
  46. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/fixture.py +0 -0
  47. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/format_common.py +0 -0
  48. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
  49. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
  50. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
  51. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/playground.py +0 -0
  52. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datafile/pull.py +0 -0
  53. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/datasource.py +0 -0
  54. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/deployment.py +0 -0
  55. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/deprecations.py +0 -0
  56. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/dev_server.py +0 -0
  57. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/endpoint.py +0 -0
  58. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/exceptions.py +0 -0
  59. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/feedback_manager.py +0 -0
  60. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/info.py +0 -0
  61. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/infra.py +0 -0
  62. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/job.py +0 -0
  63. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/llm.py +0 -0
  64. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/llm_utils.py +0 -0
  65. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/local_common.py +0 -0
  66. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/login.py +0 -0
  67. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/logout.py +0 -0
  68. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/materialization.py +0 -0
  69. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/mock.py +0 -0
  70. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/open.py +0 -0
  71. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/pipe.py +0 -0
  72. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/project.py +0 -0
  73. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/regions.py +0 -0
  74. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/secret.py +0 -0
  75. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/shell.py +0 -0
  76. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/sink.py +0 -0
  77. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/table.py +0 -0
  78. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/telemetry.py +0 -0
  79. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/test.py +0 -0
  80. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
  81. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
  82. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/token.py +0 -0
  83. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/watch.py +0 -0
  84. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb/modules/workspace_members.py +0 -0
  85. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli.py +0 -0
  86. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/auth.py +0 -0
  87. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/branch.py +0 -0
  88. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/cicd.py +0 -0
  89. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/cli.py +0 -0
  90. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/common.py +0 -0
  91. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/config.py +0 -0
  92. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/connection.py +0 -0
  93. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/datasource.py +0 -0
  94. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/exceptions.py +0 -0
  95. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/fmt.py +0 -0
  96. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/job.py +0 -0
  97. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/pipe.py +0 -0
  98. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/regions.py +0 -0
  99. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/tag.py +0 -0
  100. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/telemetry.py +0 -0
  101. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/test.py +0 -0
  102. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  103. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  104. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/workspace.py +0 -0
  105. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  106. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird/tornado_template.py +0 -0
  107. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird.egg-info/SOURCES.txt +0 -0
  108. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird.egg-info/dependency_links.txt +0 -0
  109. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird.egg-info/entry_points.txt +0 -0
  110. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird.egg-info/requires.txt +0 -0
  111. {tinybird-0.0.1.dev216 → tinybird-0.0.1.dev220}/tinybird.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev216
3
+ Version: 0.0.1.dev220
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -242,3 +242,16 @@ FORBIDDEN_SQL_KEYWORDS = {
242
242
 
243
243
  CH_SETTINGS_JOIN_ALGORITHM_HASH = "hash" # uses 'hash' by default, https://clickhouse.com/docs/en/operations/settings/settings/#settings-join_algorithm
244
244
  CH_SETTINGS_JOIN_ALGORITHM_AUTO = "auto,hash"
245
+
246
+ VALID_QUERY_FORMATS = (
247
+ "JSON",
248
+ "CSV",
249
+ "CSVWithNames",
250
+ "TSV",
251
+ "TSVWithNames",
252
+ "PrettyCompact",
253
+ "JSONEachRow",
254
+ "Parquet",
255
+ "JSONStrings",
256
+ "Prometheus",
257
+ )
@@ -1710,6 +1710,8 @@ def parse(
1710
1710
  "s3_access_key": assign_var("s3_access_key"),
1711
1711
  "s3_secret": assign_var("s3_secret"),
1712
1712
  "gcs_service_account_credentials_json": assign_var_json("gcs_service_account_credentials_json"),
1713
+ "gcs_hmac_access_id": assign_var("gcs_hmac_access_id"),
1714
+ "gcs_hmac_secret": assign_var("gcs_hmac_secret"),
1713
1715
  "include": include,
1714
1716
  },
1715
1717
  }
@@ -1,3 +1,4 @@
1
+ from datetime import date
1
2
  from typing import Optional
2
3
 
3
4
  general_functions = [
@@ -453,6 +454,8 @@ Use the following format to generate the response and do not wrap it in any othe
453
454
 
454
455
 
455
456
  def mock_prompt(rows: int, feedback: str = "") -> str:
457
+ today = date.today().isoformat()
458
+
456
459
  if feedback:
457
460
  feedback = f"""In case the <feedback> tag is present and not empty,
458
461
  it means there was a previous attempt to generate the resources and the system provided feedback about the previous response.
@@ -495,6 +498,10 @@ FROM numbers({rows})
495
498
  - The query MUST return a sample of EXACTLY {rows} rows.
496
499
  - The query MUST be valid for clickhouse and Tinybird.
497
500
  - FROM numbers({rows}) part is mandatory.
501
+ - If json paths are present (e.g. `userAgent` String `json:$.userAgent`), rely on the json paths to generate the sample record.
502
+ - If the schema has nested json paths (e.g. `json:$.location.country`), generate nested JSON objects accordingly.
503
+ - When working with dates, take into account that the current date is {today}.
504
+ - Use recent dates to avoid generating dates that are too far in the past.
498
505
  - Do NOT include ```clickhouse or ```sql or any other wrapping text to the sql query.
499
506
  - Do NOT use any of these functions: elementAt
500
507
  - Do NOT add a semicolon at the end of the query
@@ -539,58 +546,55 @@ SELECT
539
546
  arrayMap(x -> concat('item_', toString(x)), range(1, rand() % 5 + 1)) AS items
540
547
  FROM numbers(ROWS)
541
548
 
542
- ## Example schema with a nested JSON field:
549
+ ## Example schema with nested JSON paths:
543
550
 
544
551
  ### Schema:
545
552
 
546
553
  SCHEMA >
547
- `request_id` String `json:$.request_id`,
548
554
  `timestamp` DateTime `json:$.timestamp`,
549
- `model` String `json:$.request.model`,
550
- `temperature` Float32 `json:$.request.options.temperature`,
551
- `max_tokens` UInt32 `json:$.request.options.max_tokens`,
552
- `stream` UInt8 `json:$.request.options.stream`
553
-
554
- ### Desired final output of the query:
555
-
556
- Note that the important part is generating the nested fields:
557
- json:$.request.options.max_tokens > this means that the max_tokens field is nested inside the options field inside the request field.
558
-
555
+ `location_country` String `json:$.location.country`,
556
+ `location_region` String `json:$.location.region`,
557
+ `location_city` String `json:$.location.city`,
558
+ `location_latitude` String `json:$.location.latitude`,
559
+ `location_longitude` String `json:$.location.longitude`
560
+
561
+ ### Important: Understanding JSON paths
562
+ When you see json paths like `json:$.location.country`, it means the data should be structured as nested JSON:
563
+ - `json:$.location.country` the country field is nested inside the location object
564
+ - `json:$.location.region` → the region field is nested inside the location object
565
+
566
+ ### Desired final output structure:
559
567
  {{
560
- "request_id": "req_abc123",
561
568
  "timestamp": "2024-11-30T10:30:00.000Z",
562
- "request": {{
563
- "model": "gpt-4",
564
- "options": {{
565
- "temperature": 0.7,
566
- "max_tokens": 1000,
567
- "stream": false
568
- }}
569
+ "location": {{
570
+ "country": "United States",
571
+ "region": "California",
572
+ "city": "San Francisco",
573
+ "latitude": "37.7749",
574
+ "longitude": "-122.4194"
569
575
  }}
570
576
  }}
571
577
 
572
- ### Example SQL output with nested fields:
578
+ ### Example SQL output for nested JSON paths:
573
579
 
574
580
  SELECT
575
- request_id,
576
581
  timestamp,
577
582
  CAST(concat('{{
578
- "model": "', model, '",
579
- "options": {{
580
- "temperature": ', temperature, ',
581
- "max_tokens": ', max_tokens, ',
582
- "stream": ', IF(stream = 1, 'true', 'false'), '
583
- }}
584
- }}'), 'JSON') AS request
583
+ "country": "', country, '",
584
+ "region": "', region, '",
585
+ "city": "', city, '",
586
+ "latitude": "', latitude, '",
587
+ "longitude": "', longitude, '"
588
+ }}'), 'JSON') AS location
585
589
  FROM
586
590
  (
587
591
  SELECT
588
- concat('req_', lower(hex(randomString(6)))) AS request_id,
589
- (now() - toIntervalDay(rand() % 30)) + toIntervalSecond(rand() % 86400) AS timestamp,
590
- ['gpt-4', 'gpt-3.5-turbo', 'gpt-4-turbo'][(rand() % 3) + 1] AS model,
591
- round(rand() / 10, 2) AS temperature,
592
- 500 + (rand() % 2500) AS max_tokens,
593
- rand() % 2 AS stream
592
+ now() - rand() % 86400 AS timestamp,
593
+ ['United States', 'Canada', 'United Kingdom', 'Germany', 'France'][(rand() % 5) + 1] AS country,
594
+ ['California', 'Texas', 'New York', 'Ontario', 'London'][(rand() % 5) + 1] AS region,
595
+ ['San Francisco', 'Los Angeles', 'New York', 'Toronto', 'London'][(rand() % 5) + 1] AS city,
596
+ toString(round(rand() * 180 - 90, 4)) AS latitude,
597
+ toString(round(rand() * 360 - 180, 4)) AS longitude
594
598
  FROM numbers(ROWS)
595
599
  )
596
600
  </more_examples>
@@ -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.dev216'
8
- __revision__ = 'b1646cc'
7
+ __version__ = '0.0.1.dev220'
8
+ __revision__ = 'd9c7b3e'
@@ -379,6 +379,15 @@ async def create_ctx_client(ctx: Context, config: Dict[str, Any], cloud: bool, s
379
379
  click.echo(
380
380
  FeedbackManager.gray(message=f"Running against Tinybird Cloud: Workspace {config.get('name', 'default')}")
381
381
  )
382
+
383
+ method = None
384
+ if ctx.params.get("token"):
385
+ method = "token via --token option"
386
+ elif os.environ.get("TB_TOKEN"):
387
+ method = "token from TB_TOKEN environment variable"
388
+ if method:
389
+ click.echo(FeedbackManager.gray(message=f"Authentication method: {method}"))
390
+
382
391
  return _get_tb_client(config.get("token", None), config["host"], staging=staging)
383
392
  local = command in commands_always_local
384
393
  test = command in command_always_test
@@ -101,7 +101,7 @@ async def create(
101
101
  if prompt:
102
102
  prompt_result = await create_resources_from_prompt(tb_client, user_token, prompt, project)
103
103
  result.extend(prompt_result)
104
- readme_path = Path(root_folder) / "README.md"
104
+ readme_path = folder_path / "README.md"
105
105
  if readme_path.exists():
106
106
  click.echo(FeedbackManager.highlight(message="\n» Updating project description..."))
107
107
  else:
@@ -98,8 +98,9 @@ async def stop() -> None:
98
98
 
99
99
 
100
100
  @local.command()
101
+ @click.pass_context
101
102
  @coro
102
- async def status() -> None:
103
+ async def status(ctx: click.Context) -> None:
103
104
  """Check status of Tinybird Local"""
104
105
  docker_client = get_docker_client()
105
106
  container = get_existing_container_with_matching_env(docker_client, TB_CONTAINER_NAME, {})
@@ -110,6 +111,11 @@ async def status() -> None:
110
111
 
111
112
  if status == "running" and health == "healthy":
112
113
  click.echo(FeedbackManager.success(message="✓ Tinybird Local is ready!"))
114
+ click.echo(FeedbackManager.highlight(message="\n» Tinybird Local:"))
115
+ from tinybird.tb.modules.info import get_local_info
116
+
117
+ config = ctx.ensure_object(dict).get("config", {})
118
+ await get_local_info(config)
113
119
  elif status == "restarting" or (status == "running" and health == "starting"):
114
120
  click.echo(FeedbackManager.highlight(message="* Tinybird Local is starting..."))
115
121
  elif status == "removing":
@@ -288,14 +288,25 @@ async def clear_workspace() -> None:
288
288
 
289
289
  ws = next((ws for ws in local_workspaces if ws["name"] == ws_name), None)
290
290
 
291
+ if not ws:
292
+ raise CLIWorkspaceException(FeedbackManager.error(message=f"Workspace '{ws_name}' not found."))
293
+
294
+ requests.delete(f"{TB_LOCAL_ADDRESS}/v1/workspaces/{ws['id']}?token={user_token}&hard_delete_confirmation=yes") # noqa: ASYNC210
295
+ user_workspaces = await user_client.user_workspaces(version="v1")
296
+ ws = next((ws for ws in user_workspaces["workspaces"] if ws["name"] == ws_name), None)
297
+
291
298
  if ws:
292
- requests.delete(f"{TB_LOCAL_ADDRESS}/v1/workspaces/{ws['id']}?token={user_token}&hard_delete_confirmation=yes") # noqa: ASYNC210
293
- ws = None
299
+ raise CLIWorkspaceException(
300
+ FeedbackManager.error(message=f"Workspace '{ws_name}' was not cleared properly. Please try again.")
301
+ )
302
+
303
+ await user_client.create_workspace(ws_name, assign_to_organization_id=user_org_id, version="v1")
304
+ user_workspaces = requests.get(f"{TB_LOCAL_ADDRESS}/v1/user/workspaces?token={admin_token}").json() # noqa: ASYNC210
305
+ ws = next((ws for ws in user_workspaces["workspaces"] if ws["name"] == ws_name), None)
294
306
 
295
307
  if not ws:
296
- await user_client.create_workspace(ws_name, assign_to_organization_id=user_org_id, version="v1")
297
- user_workspaces = requests.get(f"{TB_LOCAL_ADDRESS}/v1/user/workspaces?token={admin_token}").json() # noqa: ASYNC210
298
- ws = next((ws for ws in user_workspaces["workspaces"] if ws["name"] == ws_name), None)
308
+ raise CLIWorkspaceException(
309
+ FeedbackManager.error(message=f"Workspace '{ws_name}' was not cleared properly. Please try again.")
310
+ )
299
311
 
300
- if ws:
301
- click.echo(FeedbackManager.success(message=f"\n✓ Workspace '{ws_name}' cleared"))
312
+ click.echo(FeedbackManager.success(message=f"✓ Workspace '{ws_name}' cleared"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev216
3
+ Version: 0.0.1.dev220
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird