tinybird-cli 5.4.1.dev1__tar.gz → 5.4.1.dev3__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.4.1.dev1 → tinybird-cli-5.4.1.dev3}/PKG-INFO +11 -1
  2. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/__cli__.py +2 -2
  3. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/ch_utils/constants.py +4 -1
  4. tinybird-cli-5.4.1.dev3/tinybird/config.py +107 -0
  5. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/datafile.py +8 -14
  6. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/auth.py +3 -1
  7. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/common.py +3 -2
  8. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird_cli.egg-info/PKG-INFO +11 -1
  9. tinybird-cli-5.4.1.dev1/tinybird/config.py +0 -63
  10. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/setup.cfg +0 -0
  11. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/ch_utils/engine.py +0 -0
  12. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/check_pypi.py +0 -0
  13. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/client.py +0 -0
  14. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/connectors.py +0 -0
  15. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/context.py +0 -0
  16. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/datatypes.py +0 -0
  17. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/feedback_manager.py +0 -0
  18. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/git_settings.py +0 -0
  19. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/sql.py +0 -0
  20. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/sql_template.py +0 -0
  21. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/sql_template_fmt.py +0 -0
  22. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/sql_toolset.py +0 -0
  23. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/syncasync.py +0 -0
  24. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli.py +0 -0
  25. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/branch.py +0 -0
  26. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/cicd.py +0 -0
  27. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/cli.py +0 -0
  28. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/config.py +0 -0
  29. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/connection.py +0 -0
  30. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/datasource.py +0 -0
  31. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/exceptions.py +0 -0
  32. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/job.py +0 -0
  33. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/pipe.py +0 -0
  34. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/regions.py +0 -0
  35. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/telemetry.py +0 -0
  36. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/test.py +0 -0
  37. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  38. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  39. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/token.py +0 -0
  40. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/workspace.py +0 -0
  41. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  42. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird/tornado_template.py +0 -0
  43. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird_cli.egg-info/SOURCES.txt +0 -0
  44. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird_cli.egg-info/dependency_links.txt +0 -0
  45. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird_cli.egg-info/entry_points.txt +0 -0
  46. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/tinybird_cli.egg-info/requires.txt +0 -0
  47. {tinybird-cli-5.4.1.dev1 → tinybird-cli-5.4.1.dev3}/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.4.1.dev1
3
+ Version: 5.4.1.dev3
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.4.1.dev3
22
+ **********
23
+
24
+ - `Changed` Internal change
25
+
26
+ 5.4.1.dev1
27
+ **********
28
+
29
+ - `Fixed` regions list when usign `tb auth --interactive`, `tb auth ls` and `tb auth info`
30
+
21
31
  5.4.0
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.4.1.dev1'
8
- __revision__ = 'c9417dd'
7
+ __version__ = '5.4.1.dev3'
8
+ __revision__ = '8c78a34'
@@ -4,7 +4,10 @@ LIVE_WS_NAME = "live"
4
4
  SNAPSHOT_WS_NAME = "snapshot"
5
5
 
6
6
  ENABLED_TABLE_FUNCTIONS = {"generateRandom", "null", "numbers", "numbers_mt", "values", "zeros", "zeros_mt"}
7
- COPY_ENABLED_TABLE_FUNCTIONS = frozenset(["postgresql"])
7
+ # there's a workspace limit allowed_table_functions used in the APIs limit in cheriff
8
+ COPY_ENABLED_TABLE_FUNCTIONS = frozenset(
9
+ ["postgresql", "mysql", "mongodb", "url", "azureBlobStorage", "gcs", "iceberg", "s3"]
10
+ )
8
11
 
9
12
  ENABLED_SYSTEM_TABLES = {
10
13
  "functions",
@@ -0,0 +1,107 @@
1
+ import json
2
+ from os import environ, getcwd
3
+ from pathlib import Path
4
+ from typing import Any, Dict, Optional
5
+
6
+ import click
7
+
8
+ from tinybird import __cli__
9
+ from tinybird.feedback_manager import FeedbackManager
10
+
11
+ try:
12
+ from tinybird.__cli__ import __revision__
13
+ except Exception:
14
+ __revision__ = ""
15
+
16
+ DEFAULT_API_HOST = "https://api.tinybird.co"
17
+ DEFAULT_LOCALHOST = "http://localhost:8001"
18
+ CURRENT_VERSION = f"{__cli__.__version__}"
19
+ VERSION = f"{__cli__.__version__} (rev {__revision__})"
20
+ DEFAULT_UI_HOST = "https://app.tinybird.co"
21
+ SUPPORTED_CONNECTORS = ["bigquery", "snowflake"]
22
+ PROJECT_PATHS = ["datasources", "datasources/fixtures", "endpoints", "pipes", "tests", "scripts", "deploy"]
23
+ DEPRECATED_PROJECT_PATHS = ["endpoints"]
24
+ MIN_WORKSPACE_ID_LENGTH = 36
25
+ LEGACY_HOSTS = {
26
+ "https://api.tinybird.co": "https://app.tinybird.co/gcp/europe-west3",
27
+ "https://api.us-east.tinybird.co": "https://app.tinybird.co/gcp/us-east4",
28
+ "https://api.us-east.aws.tinybird.co": "https://app.tinybird.co/aws/us-east-1",
29
+ "https://api.us-west-2.aws.tinybird.co": "https://app.tinybird.co/aws/us-west-2",
30
+ "https://api.eu-central-1.aws.tinybird.co": "https://app.tinybird.co/aws/eu-central-1",
31
+ "https://api.ap-east.aws.tinybird.co": "https://app.tinybird.co/aws/ap-east",
32
+ "https://api.wadus1.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus1",
33
+ "https://api.wadus2.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus2",
34
+ "https://api.wadus3.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus3",
35
+ "https://api.wadus4.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus4",
36
+ "https://api.wadus5.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus5",
37
+ "https://api.wadus6.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus6",
38
+ "https://ui.tinybird.co": "https://app.tinybird.co/gcp/europe-west3",
39
+ "https://ui.us-east.tinybird.co": "https://app.tinybird.co/gcp/us-east4",
40
+ "https://ui.us-east.aws.tinybird.co": "https://app.tinybird.co/aws/us-east-1",
41
+ "https://ui.us-west-2.aws.tinybird.co": "https://app.tinybird.co/aws/us-west-2",
42
+ "https://ui.eu-central-1.aws.tinybird.co": "https://app.tinybird.co/aws/eu-central-1",
43
+ "https://ui.ap-east.aws.tinybird.co": "https://app.tinybird.co/aws/ap-east",
44
+ "https://inditex-tech.tinybird.co": "https://app.inditex.tinybird.co/gcp/inditex-tech",
45
+ "https://inditex-c-stg.tinybird.co": "https://app.inditex.tinybird.co/gcp/inditex-c-stg",
46
+ "https://inditex-c-pro.tinybird.co": "https://app.inditex.tinybird.co/gcp/inditex-c-pro",
47
+ "https://inditex-z-stg.tinybird.co": "https://app.inditex.tinybird.co/gcp/inditex-z-stg",
48
+ "https://inditex-rt-pro.tinybird.co": "https://app.inditex.tinybird.co/gcp/inditex-rt-pro",
49
+ "https://inditex-pro.tinybird.co": "https://app.inditex.tinybird.co/gcp/inditex-pro",
50
+ "https://ui.split.tinybird.co": "https://app.tinybird.co/aws/split-us-east",
51
+ "https://ui.split.us-west-2.aws.tinybird.co": "https://app.tinybird.co/aws/aws/split-us-west-2",
52
+ "https://ui.split.azure.tinybird.co": "https://app.tinybird.co/azure/split-us-east",
53
+ "https://ui.split-westeurope.azure.tinybird.co": "https://app.tinybird.co/azure/split-westeurope",
54
+ "https://ui.wadus1.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus1",
55
+ "https://ui.wadus2.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus2",
56
+ "https://ui.wadus3.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus3",
57
+ "https://ui.wadus4.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus4",
58
+ "https://ui.wadus5.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus5",
59
+ "https://ui.wadus6.gcp.tinybird.co": "https://app.wadus.tinybird.co/gcp/wadus6",
60
+ "https://ui.wadus1.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus1",
61
+ "https://ui.wadus2.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus2",
62
+ "https://ui.wadus3.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus3",
63
+ "https://ui.wadus4.aws.tinybird.co": "https://app.wadus.tinybird.co/aws/wadus4",
64
+ }
65
+
66
+
67
+ async def get_config(host: str, token: Optional[str], semver: Optional[str] = None) -> Dict[str, Any]:
68
+ if host:
69
+ host = host.rstrip("/")
70
+
71
+ config_file = Path(getcwd()) / ".tinyb"
72
+ config = {}
73
+ try:
74
+ with open(config_file) as file:
75
+ config = json.loads(file.read())
76
+ except IOError:
77
+ pass
78
+ except json.decoder.JSONDecodeError:
79
+ click.echo(FeedbackManager.error_load_file_config(config_file=config_file))
80
+ return config
81
+
82
+ config["token_passed"] = token
83
+ config["token"] = token or config.get("token", None)
84
+ config["semver"] = semver or config.get("semver", None)
85
+ config["host"] = host or config.get("host", DEFAULT_API_HOST)
86
+ config["workspaces"] = config.get("workspaces", [])
87
+ return config
88
+
89
+
90
+ async def write_config(config: Dict[str, Any], dest_file: str = ".tinyb"):
91
+ config_file = Path(getcwd()) / dest_file
92
+ with open(config_file, "w") as file:
93
+ file.write(json.dumps(config, indent=4, sort_keys=True))
94
+
95
+
96
+ def get_display_host(ui_host: str):
97
+ return LEGACY_HOSTS.get(ui_host, ui_host)
98
+
99
+
100
+ class FeatureFlags:
101
+ @classmethod
102
+ def ignore_sql_errors(cls) -> bool: # Context: #1155
103
+ return "TB_IGNORE_SQL_ERRORS" in environ
104
+
105
+ @classmethod
106
+ def is_localhost(cls) -> bool:
107
+ return "SET_LOCALHOST" in environ
@@ -3047,20 +3047,14 @@ async def new_ds(
3047
3047
  and params.get("connector")
3048
3048
  and params.get("bucket_uri")
3049
3049
  ):
3050
- data = await client.preview_bucket(params["connector"], params["bucket_uri"])
3051
- if data:
3052
- files = data.get("files", [])
3053
- if len(files) > 0:
3054
- file_name = files[0].get("name", "")
3055
- extension = file_name.split(".")[-1]
3056
- if extension == "gz":
3057
- extension = file_name.split(".")[-2]
3058
- valid_formats = ["csv", "json", "jsonl", "ndjson", "parquet"]
3059
- if extension not in valid_formats:
3060
- raise Exception(
3061
- FeedbackManager.error_format(extension=extension, valid_formats=valid_formats)
3062
- )
3063
- params["format"] = extension
3050
+ bucket_uri = params.get("bucket_uri")
3051
+ extension = bucket_uri.split(".")[-1]
3052
+ if extension == "gz":
3053
+ extension = bucket_uri.split(".")[-2]
3054
+ valid_formats = ["csv", "json", "jsonl", "ndjson", "parquet"]
3055
+ if extension not in valid_formats:
3056
+ raise Exception(FeedbackManager.error_format(extension=extension, valid_formats=valid_formats))
3057
+ params["format"] = extension
3064
3058
  datasource_response = await client.datasource_create_from_definition(params)
3065
3059
  datasource = datasource_response.get("datasource", {})
3066
3060
 
@@ -8,6 +8,7 @@ from typing import Any, Dict, List, Optional
8
8
  import click
9
9
  import humanfriendly.tables
10
10
 
11
+ from tinybird.config import get_display_host
11
12
  from tinybird.feedback_manager import FeedbackManager
12
13
  from tinybird.tb_cli_modules.cli import cli
13
14
  from tinybird.tb_cli_modules.common import (
@@ -157,7 +158,8 @@ async def auth_info() -> None:
157
158
  token = f"{config.get_token()} ({token_origin})"
158
159
 
159
160
  host_origin = ORIGINS.get(config.get_value_origin("host"), "")
160
- host = f"{config.get_host()} ({host_origin})"
161
+ host_name = get_display_host(config.get_host() or "")
162
+ host = f"{host_name} ({host_origin})"
161
163
 
162
164
  if config.get_user_token():
163
165
  user_token_origin = ORIGINS.get(config.get_value_origin("user_token"), "")
@@ -50,6 +50,7 @@ from tinybird.config import (
50
50
  VERSION,
51
51
  FeatureFlags,
52
52
  get_config,
53
+ get_display_host,
53
54
  write_config,
54
55
  )
55
56
 
@@ -1874,7 +1875,7 @@ async def try_authenticate(
1874
1875
  config.set_host(api_host)
1875
1876
 
1876
1877
  if not token:
1877
- token = ask_for_admin_token_interactively(ui_host, default_token=default_password)
1878
+ token = ask_for_admin_token_interactively(get_display_host(ui_host), default_token=default_password)
1878
1879
  config.set_token(token)
1879
1880
 
1880
1881
  add_telemetry_event("auth_token", token=token)
@@ -1891,7 +1892,7 @@ async def try_authenticate(
1891
1892
  config.set_host(host)
1892
1893
  authenticated = await try_update_config_with_remote(config, raise_on_errors=False)
1893
1894
  if authenticated:
1894
- click.echo(FeedbackManager.success_using_host(name=name, host=ui_host))
1895
+ click.echo(FeedbackManager.success_using_host(name=name, host=get_display_host(ui_host)))
1895
1896
  break
1896
1897
 
1897
1898
  if not authenticated:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird-cli
3
- Version: 5.4.1.dev1
3
+ Version: 5.4.1.dev3
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.4.1.dev3
22
+ **********
23
+
24
+ - `Changed` Internal change
25
+
26
+ 5.4.1.dev1
27
+ **********
28
+
29
+ - `Fixed` regions list when usign `tb auth --interactive`, `tb auth ls` and `tb auth info`
30
+
21
31
  5.4.0
22
32
  **********
23
33
 
@@ -1,63 +0,0 @@
1
- import json
2
- from os import environ, getcwd
3
- from pathlib import Path
4
- from typing import Any, Dict, Optional
5
-
6
- import click
7
-
8
- from tinybird import __cli__
9
- from tinybird.feedback_manager import FeedbackManager
10
-
11
- try:
12
- from tinybird.__cli__ import __revision__
13
- except Exception:
14
- __revision__ = ""
15
-
16
- DEFAULT_API_HOST = "https://api.tinybird.co"
17
- DEFAULT_LOCALHOST = "http://localhost:8001"
18
- CURRENT_VERSION = f"{__cli__.__version__}"
19
- VERSION = f"{__cli__.__version__} (rev {__revision__})"
20
- DEFAULT_UI_HOST = "https://ui.tinybird.co"
21
- SUPPORTED_CONNECTORS = ["bigquery", "snowflake"]
22
- PROJECT_PATHS = ["datasources", "datasources/fixtures", "endpoints", "pipes", "tests", "scripts", "deploy"]
23
- DEPRECATED_PROJECT_PATHS = ["endpoints"]
24
- MIN_WORKSPACE_ID_LENGTH = 36
25
-
26
-
27
- async def get_config(host: str, token: Optional[str], semver: Optional[str] = None) -> Dict[str, Any]:
28
- if host:
29
- host = host.rstrip("/")
30
-
31
- config_file = Path(getcwd()) / ".tinyb"
32
- config = {}
33
- try:
34
- with open(config_file) as file:
35
- config = json.loads(file.read())
36
- except IOError:
37
- pass
38
- except json.decoder.JSONDecodeError:
39
- click.echo(FeedbackManager.error_load_file_config(config_file=config_file))
40
- return config
41
-
42
- config["token_passed"] = token
43
- config["token"] = token or config.get("token", None)
44
- config["semver"] = semver or config.get("semver", None)
45
- config["host"] = host or config.get("host", DEFAULT_API_HOST)
46
- config["workspaces"] = config.get("workspaces", [])
47
- return config
48
-
49
-
50
- async def write_config(config: Dict[str, Any], dest_file: str = ".tinyb"):
51
- config_file = Path(getcwd()) / dest_file
52
- with open(config_file, "w") as file:
53
- file.write(json.dumps(config, indent=4, sort_keys=True))
54
-
55
-
56
- class FeatureFlags:
57
- @classmethod
58
- def ignore_sql_errors(cls) -> bool: # Context: #1155
59
- return "TB_IGNORE_SQL_ERRORS" in environ
60
-
61
- @classmethod
62
- def is_localhost(cls) -> bool:
63
- return "SET_LOCALHOST" in environ