tinybird-cli 5.5.1.dev3__tar.gz → 5.5.1.dev5__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.
Files changed (47) hide show
  1. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/PKG-INFO +11 -1
  2. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/__cli__.py +2 -2
  3. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/client.py +1 -3
  4. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/datafile.py +11 -0
  5. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/feedback_manager.py +3 -0
  6. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/sql_template.py +14 -14
  7. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/common.py +3 -2
  8. tinybird-cli-5.5.1.dev5/tinybird/tb_cli_modules/regions.py +9 -0
  9. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird_cli.egg-info/PKG-INFO +11 -1
  10. tinybird-cli-5.5.1.dev3/tinybird/tb_cli_modules/regions.py +0 -79
  11. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/setup.cfg +0 -0
  12. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/ch_utils/constants.py +0 -0
  13. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/ch_utils/engine.py +0 -0
  14. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/check_pypi.py +0 -0
  15. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/config.py +0 -0
  16. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/connectors.py +0 -0
  17. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/context.py +0 -0
  18. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/datatypes.py +0 -0
  19. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/git_settings.py +0 -0
  20. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/sql.py +0 -0
  21. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/sql_template_fmt.py +0 -0
  22. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/sql_toolset.py +0 -0
  23. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/syncasync.py +0 -0
  24. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli.py +0 -0
  25. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/auth.py +0 -0
  26. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/branch.py +0 -0
  27. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/cicd.py +0 -0
  28. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/cli.py +0 -0
  29. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/config.py +0 -0
  30. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/connection.py +0 -0
  31. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/datasource.py +0 -0
  32. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/exceptions.py +0 -0
  33. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/job.py +0 -0
  34. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/pipe.py +0 -0
  35. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/telemetry.py +0 -0
  36. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/test.py +0 -0
  37. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  38. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  39. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/token.py +0 -0
  40. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/workspace.py +0 -0
  41. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  42. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird/tornado_template.py +0 -0
  43. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird_cli.egg-info/SOURCES.txt +0 -0
  44. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird_cli.egg-info/dependency_links.txt +0 -0
  45. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird_cli.egg-info/entry_points.txt +0 -0
  46. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird_cli.egg-info/requires.txt +0 -0
  47. {tinybird-cli-5.5.1.dev3 → tinybird-cli-5.5.1.dev5}/tinybird_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 5.5.1.dev3
3
+ Version: 5.5.1.dev5
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -18,6 +18,16 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
18
18
  Changelog
19
19
  ----------
20
20
 
21
+ 5.5.1.dev5
22
+ **********
23
+
24
+ - `Fixed` region list for AWS and custom regions when usign `tb auth --interactive`
25
+
26
+ 5.5.1.dev4
27
+ **********
28
+
29
+ - `Added` Add `IMPORT_FROM_TIMESTAMP` to the list of supported directives in the CLI for S3 Data Sources, files added to the S3 bucket before that time will be ignored. [Read our docs for more information.](https://www.tinybird.co/docs/ingest/s3)
30
+
21
31
  5.5.1.dev3
22
32
  **********
23
33
 
@@ -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__ = '5.5.1.dev3'
8
- __revision__ = '13e87e0'
7
+ __version__ = '5.5.1.dev5'
8
+ __revision__ = '3811426'
@@ -13,7 +13,6 @@ from urllib3 import Retry
13
13
 
14
14
  from tinybird.ch_utils.constants import COPY_ENABLED_TABLE_FUNCTIONS
15
15
  from tinybird.syncasync import sync_to_async
16
- from tinybird.tb_cli_modules.regions import fill_with_public_regions
17
16
  from tinybird.tb_cli_modules.telemetry import add_telemetry_event
18
17
 
19
18
  HOST = "https://api.tinybird.co"
@@ -1101,8 +1100,7 @@ class TinyB(object):
1101
1100
 
1102
1101
  async def regions(self):
1103
1102
  regions = await self._req("/v0/regions")
1104
- regions_superset = fill_with_public_regions(regions)
1105
- return regions_superset
1103
+ return regions
1106
1104
 
1107
1105
  async def datasource_query_copy(self, datasource_name: str, sql_query: str):
1108
1106
  params = {"copy_to": datasource_name}
@@ -3,6 +3,7 @@ Datafile is like a Dockerfile but to describe ETL processes
3
3
  """
4
4
 
5
5
  from asyncio import Semaphore, gather
6
+ from datetime import datetime
6
7
 
7
8
  from requests import Response
8
9
 
@@ -148,6 +149,7 @@ class ImportReplacements:
148
149
  ("import_connector", "connector", None),
149
150
  ("import_external_datasource", "external_data_source", None),
150
151
  ("import_bucket_uri", "bucket_uri", None),
152
+ ("import_from_timestamp", "from_time", None),
151
153
  ("import_table_arn", "dynamodb_table_arn", None),
152
154
  ("import_export_bucket", "dynamodb_export_bucket", None),
153
155
  )
@@ -1145,6 +1147,7 @@ def parse(
1145
1147
  "import_strategy": assign_var("import_strategy"),
1146
1148
  "import_external_datasource": assign_var("import_external_datasource"),
1147
1149
  "import_bucket_uri": assign_var("import_bucket_uri"),
1150
+ "import_from_timestamp": assign_var("import_from_timestamp"),
1148
1151
  "import_query": assign_var("import_query"),
1149
1152
  "import_table_arn": assign_var("import_table_arn"),
1150
1153
  "import_export_bucket": assign_var("import_export_bucket"),
@@ -1349,6 +1352,14 @@ async def process_file(
1349
1352
  if service:
1350
1353
  params["import_service"] = service
1351
1354
 
1355
+ if import_from_timestamp := params.get("import_from_timestamp", None):
1356
+ try:
1357
+ str(datetime.fromisoformat(import_from_timestamp).isoformat())
1358
+ except ValueError:
1359
+ raise click.ClickException(
1360
+ FeedbackManager.error_invalid_import_from_timestamp(datasource=datasource["name"])
1361
+ )
1362
+
1352
1363
  if service in PREVIEW_CONNECTOR_SERVICES:
1353
1364
  if not params.get("import_bucket_uri", None):
1354
1365
  raise click.ClickException(FeedbackManager.error_missing_bucket_uri(datasource=datasource["name"]))
@@ -299,6 +299,9 @@ class FeedbackManager:
299
299
  error_missing_bucket_uri = error_message(
300
300
  "Missing IMPORT_BUCKET_URI in '{datasource}'.\n** See https://www.tinybird.co/docs/ingest/s3 to learn more."
301
301
  )
302
+ error_invalid_import_from_timestamp = error_message(
303
+ "Invalid IMPORT_FROM_TIMESTAMP in '{datasource}'.\n** See https://www.tinybird.co/docs/ingest/s3 to learn more."
304
+ )
302
305
  error_missing_table_arn = error_message(
303
306
  "Missing IMPORT_TABLE_ARN in '{datasource}'.\n** See https://www.tinybird.co/docs/ingest/dynamodb to learn more."
304
307
  )
@@ -190,11 +190,11 @@ class Comment:
190
190
 
191
191
  class Placeholder:
192
192
  def __init__(self, name=None, line=None):
193
- self.name = name if name else "__placeholder__"
193
+ self.name = name if name else "__no_value__"
194
194
  self.line = line or "unknown"
195
195
 
196
196
  def __str__(self):
197
- return "__placeholder__"
197
+ return "__no_value__"
198
198
 
199
199
  def __getitem__(self, i):
200
200
  if i > 2:
@@ -371,7 +371,7 @@ def array_type(types): # noqa: C901
371
371
  if _type and _type in types:
372
372
  x = ",".join(map(str, [types[_type](x) for _ in range(2)]))
373
373
  else:
374
- x = ",".join([f"__placeholder__{i}" for i in range(2)])
374
+ x = ",".join([f"__no_value__{i}" for i in range(2)])
375
375
  elif x is None:
376
376
  x = default
377
377
  if x is None:
@@ -449,7 +449,7 @@ def string_type(x, default=None):
449
449
  if default:
450
450
  x = default
451
451
  else:
452
- x = "__placeholder__"
452
+ x = "__no_value__"
453
453
  return x
454
454
 
455
455
 
@@ -754,7 +754,7 @@ def json_type(x, default=None):
754
754
  if default:
755
755
  x = default
756
756
  else:
757
- x = "__placeholder__"
757
+ x = "__no_value__"
758
758
 
759
759
  try:
760
760
  if x is None:
@@ -1003,7 +1003,7 @@ def get_transform_types(placeholders=None):
1003
1003
  "String": transform_type(
1004
1004
  "String",
1005
1005
  str,
1006
- placeholder="__placeholder__",
1006
+ placeholder="__no_value__",
1007
1007
  required=None,
1008
1008
  description=None,
1009
1009
  enum=None,
@@ -1212,7 +1212,7 @@ def get_transform_types(placeholders=None):
1212
1212
  "String": transform_type(
1213
1213
  "String",
1214
1214
  str,
1215
- placeholder="__placeholder__",
1215
+ placeholder="__no_value__",
1216
1216
  required=None,
1217
1217
  description=None,
1218
1218
  enum=None,
@@ -1310,7 +1310,7 @@ def expression_wrapper(x, name, escape_arrays: bool = False):
1310
1310
  if type(x) in (unicode_type, bytes, str):
1311
1311
  return "'" + sqlescape_for_string_expression(x) + "'"
1312
1312
  elif isinstance(x, Placeholder):
1313
- return "'__placeholder__'"
1313
+ return "'__no_value__'"
1314
1314
  elif isinstance(x, Comment):
1315
1315
  return "-- {x} \n"
1316
1316
  if x is None:
@@ -1987,7 +1987,7 @@ def render_sql_template(
1987
1987
  >>> render_sql_template("select * from table where f = {{Float32(foo)}}", test_mode=True)
1988
1988
  ("select * from table where f = toFloat32('0.0')", {}, [])
1989
1989
  >>> render_sql_template("SELECT * FROM query_log__dev where a = {{test}}", test_mode=True)
1990
- ("SELECT * FROM query_log__dev where a = '__placeholder__'", {}, [])
1990
+ ("SELECT * FROM query_log__dev where a = '__no_value__'", {}, [])
1991
1991
  >>> render_sql_template("SELECT {{test}}", {'token':'testing'})
1992
1992
  Traceback (most recent call last):
1993
1993
  ...
@@ -1997,7 +1997,7 @@ def render_sql_template(
1997
1997
  >>> render_sql_template('{% if Int32(test, 1) %}SELECT 1{% else %} select 2 {% end %}')
1998
1998
  ('SELECT 1', {}, [])
1999
1999
  >>> render_sql_template('{% for v in test %}SELECT {{v}} {% end %}',test_mode=True)
2000
- ("SELECT '__placeholder__' SELECT '__placeholder__' SELECT '__placeholder__' ", {}, [])
2000
+ ("SELECT '__no_value__' SELECT '__no_value__' SELECT '__no_value__' ", {}, [])
2001
2001
  >>> render_sql_template("select {{Int32(foo, 1)}}", test_mode=True)
2002
2002
  ("select toInt32('1')", {}, [])
2003
2003
  >>> render_sql_template("SELECT count() c FROM test_table where a > {{Float32(myvar)}} {% if defined(my_condition) %} and c = Int32({{my_condition}}){% end %}", {'myvar': 1.0})
@@ -2031,11 +2031,11 @@ def render_sql_template(
2031
2031
  >>> render_sql_template("SELECT {{Array(foo, 'Int32')}}", test_mode=True)
2032
2032
  ('SELECT [0,0]', {}, [])
2033
2033
  >>> render_sql_template("SELECT {{Array(foo)}}", test_mode=True)
2034
- ("SELECT ['__placeholder__0','__placeholder__1']", {}, [])
2034
+ ("SELECT ['__no_value__0','__no_value__1']", {}, [])
2035
2035
  >>> render_sql_template("{{max_threads(2)}} SELECT 1")
2036
2036
  ('-- max_threads 2\\n SELECT 1', {'max_threads': 2}, [])
2037
2037
  >>> render_sql_template("SELECT {{String(foo)}}", test_mode=True)
2038
- ("SELECT '__placeholder__'", {}, [])
2038
+ ("SELECT '__no_value__'", {}, [])
2039
2039
  >>> render_sql_template("SELECT {{String(foo, 'test')}}", test_mode=True)
2040
2040
  ("SELECT 'test'", {}, [])
2041
2041
  >>> render_sql_template("SELECT {{String(foo, 'test')}}", {'foo': 'tt'})
@@ -2065,7 +2065,7 @@ def render_sql_template(
2065
2065
  >>> render_sql_template('{% if not defined(test) %}custom_error({error: "This is an error"}){% end %}', {})
2066
2066
  ('custom_error({error: "This is an error"})', {}, [])
2067
2067
  >>> render_sql_template("SELECT {{String(foo + 'abcd')}}", test_mode=True)
2068
- ("SELECT '__placeholder__'", {}, [])
2068
+ ("SELECT '__no_value__'", {}, [])
2069
2069
  >>> render_sql_template("SELECT {{columns(agg)}}", {})
2070
2070
  Traceback (most recent call last):
2071
2071
  ...
@@ -2131,7 +2131,7 @@ def render_sql_template(
2131
2131
  >>> render_sql_template("% {% for kv in JSON(payload) %} department = {{kv['dp']}} {% end %}", test_mode=True)
2132
2132
  Traceback (most recent call last):
2133
2133
  ...
2134
- tinybird.sql_template.SQLTemplateException: Template Syntax Error: Error parsing JSON: '__placeholder__' - Expecting value: line 1 column 1 (char 0)
2134
+ tinybird.sql_template.SQLTemplateException: Template Syntax Error: Error parsing JSON: '__no_value__' - Expecting value: line 1 column 1 (char 0)
2135
2135
  >>> render_sql_template("% {% for kv in JSON(payload, '') %} department = {{kv['dp']}} {% end %}")
2136
2136
  Traceback (most recent call last):
2137
2137
  ...
@@ -1765,7 +1765,8 @@ async def get_regions_temp(config: CLIConfig) -> List[Region]:
1765
1765
  regions: List[Region] = []
1766
1766
 
1767
1767
  try:
1768
- regions = await config.get_client().regions()
1768
+ response = await config.get_client().regions()
1769
+ regions = response.get("regions", [])
1769
1770
  except Exception:
1770
1771
  pass
1771
1772
 
@@ -1782,7 +1783,7 @@ async def get_regions_temp(config: CLIConfig) -> List[Region]:
1782
1783
  regions.append(
1783
1784
  {
1784
1785
  "api_host": format_host(key, subdomain="api"),
1785
- "host": format_host(key, subdomain="ui"),
1786
+ "host": get_display_host(key),
1786
1787
  "name": key,
1787
1788
  "default_password": config["tokens"][key],
1788
1789
  "provider": "",
@@ -0,0 +1,9 @@
1
+ from typing import Optional, TypedDict
2
+
3
+
4
+ class Region(TypedDict):
5
+ name: str
6
+ provider: str
7
+ api_host: str
8
+ host: str
9
+ default_password: Optional[str]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 5.5.1.dev3
3
+ Version: 5.5.1.dev5
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -18,6 +18,16 @@ The Tinybird command-line tool allows you to use all the Tinybird functionality
18
18
  Changelog
19
19
  ----------
20
20
 
21
+ 5.5.1.dev5
22
+ **********
23
+
24
+ - `Fixed` region list for AWS and custom regions when usign `tb auth --interactive`
25
+
26
+ 5.5.1.dev4
27
+ **********
28
+
29
+ - `Added` Add `IMPORT_FROM_TIMESTAMP` to the list of supported directives in the CLI for S3 Data Sources, files added to the S3 bucket before that time will be ignored. [Read our docs for more information.](https://www.tinybird.co/docs/ingest/s3)
30
+
21
31
  5.5.1.dev3
22
32
  **********
23
33
 
@@ -1,79 +0,0 @@
1
- from typing import List, Optional, TypedDict
2
-
3
-
4
- class Region(TypedDict):
5
- name: str
6
- provider: str
7
- api_host: str
8
- host: str
9
- default_password: Optional[str]
10
-
11
-
12
- # Maintain in sync with `production.ts`
13
-
14
- regions_list: List[Region] = [
15
- {
16
- "name": "europe-west3",
17
- "provider": "gcp",
18
- "api_host": "https://api.tinybird.co",
19
- "host": "https://app.tinybird.co/gcp/europe-west3",
20
- "default_password": "",
21
- },
22
- {
23
- "name": "us-east4",
24
- "provider": "gcp",
25
- "api_host": "https://api.us-east.tinybird.co",
26
- "host": "https://app.tinybird.co/gcp/us-east4",
27
- "default_password": "",
28
- },
29
- {
30
- "name": "us-east-1",
31
- "provider": "aws",
32
- "api_host": "https://api.us-east.aws.tinybird.co",
33
- "host": "https://app.tinybird.co/aws/us-east-1",
34
- "default_password": "",
35
- },
36
- {
37
- "name": "us-west-2",
38
- "provider": "aws",
39
- "api_host": "https://api.us-west-2.aws.tinybird.co",
40
- "host": "https://app.tinybird.co/aws/us-west-2",
41
- "default_password": "",
42
- },
43
- {
44
- "name": "eu-central-1",
45
- "provider": "aws",
46
- "api_host": "https://api.eu-central-1.aws.tinybird.co",
47
- "host": "https://app.tinybird.co/aws/eu-central-1",
48
- "default_password": "",
49
- },
50
- ]
51
-
52
-
53
- def regions_has_a_public_region(public_regions: List[Region], initial_regions: List[Region]) -> bool:
54
- in_a_public_region = False
55
-
56
- for region in initial_regions:
57
- existing_region = next(
58
- (
59
- public_region
60
- for public_region in public_regions
61
- if region["api_host"] == public_region["api_host"] or region["host"] == public_region["host"]
62
- ),
63
- None,
64
- )
65
- if existing_region:
66
- in_a_public_region = True
67
- break
68
-
69
- return in_a_public_region
70
-
71
-
72
- def fill_with_public_regions(regions) -> List[Region]:
73
- initial_regions = regions.get("regions", [])
74
- if regions_has_a_public_region(regions_list, initial_regions):
75
- initial_regions += [
76
- region for region in regions_list if region["api_host"] not in [r["api_host"] for r in initial_regions]
77
- ]
78
-
79
- return initial_regions