tinybird 0.0.1.dev120__py3-none-any.whl → 0.0.1.dev121__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/tb/__cli__.py +2 -2
- tinybird/tb/client.py +15 -6
- tinybird/tb/modules/common.py +18 -31
- tinybird/tb/modules/connection.py +7 -1
- tinybird/tb/modules/open.py +3 -2
- {tinybird-0.0.1.dev120.dist-info → tinybird-0.0.1.dev121.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev120.dist-info → tinybird-0.0.1.dev121.dist-info}/RECORD +10 -10
- {tinybird-0.0.1.dev120.dist-info → tinybird-0.0.1.dev121.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev120.dist-info → tinybird-0.0.1.dev121.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev120.dist-info → tinybird-0.0.1.dev121.dist-info}/top_level.txt +0 -0
tinybird/tb/__cli__.py
CHANGED
|
@@ -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__ = '0.0.1.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev121'
|
|
8
|
+
__revision__ = '3609440'
|
tinybird/tb/client.py
CHANGED
|
@@ -1177,14 +1177,23 @@ class TinyB:
|
|
|
1177
1177
|
except Exception:
|
|
1178
1178
|
return False
|
|
1179
1179
|
|
|
1180
|
-
async def get_trust_policy(self, service: str) -> Dict[str, Any]:
|
|
1181
|
-
|
|
1180
|
+
async def get_trust_policy(self, service: str, external_id_seed: Optional[str] = None) -> Dict[str, Any]:
|
|
1181
|
+
params = {}
|
|
1182
|
+
if external_id_seed:
|
|
1183
|
+
params["external_id_seed"] = external_id_seed
|
|
1184
|
+
return await self._req(f"/v0/integrations/{service}/policies/trust-policy?{urlencode(params)}")
|
|
1182
1185
|
|
|
1183
|
-
async def get_access_write_policy(self, service: str) -> Dict[str, Any]:
|
|
1184
|
-
|
|
1186
|
+
async def get_access_write_policy(self, service: str, bucket: Optional[str] = None) -> Dict[str, Any]:
|
|
1187
|
+
params = {}
|
|
1188
|
+
if bucket:
|
|
1189
|
+
params["bucket"] = bucket
|
|
1190
|
+
return await self._req(f"/v0/integrations/{service}/policies/write-access-policy?{urlencode(params)}")
|
|
1185
1191
|
|
|
1186
|
-
async def get_access_read_policy(self, service: str) -> Dict[str, Any]:
|
|
1187
|
-
|
|
1192
|
+
async def get_access_read_policy(self, service: str, bucket: Optional[str] = None) -> Dict[str, Any]:
|
|
1193
|
+
params = {}
|
|
1194
|
+
if bucket:
|
|
1195
|
+
params["bucket"] = bucket
|
|
1196
|
+
return await self._req(f"/v0/integrations/{service}/policies/read-access-policy?{urlencode(params)}")
|
|
1188
1197
|
|
|
1189
1198
|
async def sql_get_format(self, sql: str, with_clickhouse_format: bool = False) -> str:
|
|
1190
1199
|
try:
|
tinybird/tb/modules/common.py
CHANGED
|
@@ -1758,6 +1758,7 @@ async def run_aws_iamrole_connection_flow(
|
|
|
1758
1758
|
client: TinyB,
|
|
1759
1759
|
service: str,
|
|
1760
1760
|
environment: str,
|
|
1761
|
+
connection_name: str,
|
|
1761
1762
|
) -> Tuple[str, str, str]:
|
|
1762
1763
|
if service == DataConnectorType.AMAZON_DYNAMODB:
|
|
1763
1764
|
raise NotImplementedError("DynamoDB is not supported")
|
|
@@ -1771,8 +1772,9 @@ async def run_aws_iamrole_connection_flow(
|
|
|
1771
1772
|
region = click.prompt("🌐 Region (the region where the bucket is located, e.g. 'us-east-1')", prompt_suffix="\n> ")
|
|
1772
1773
|
validate_string_connector_param("Region", region)
|
|
1773
1774
|
|
|
1774
|
-
access_policy, trust_policy, _ = await get_aws_iamrole_policies(
|
|
1775
|
-
|
|
1775
|
+
access_policy, trust_policy, _ = await get_aws_iamrole_policies(
|
|
1776
|
+
client, service=service, policy="read", bucket=bucket_name, external_id_seed=connection_name
|
|
1777
|
+
)
|
|
1776
1778
|
|
|
1777
1779
|
click.echo(FeedbackManager.prompt_s3_iamrole_connection_login_aws())
|
|
1778
1780
|
click.echo(FeedbackManager.click_enter_to_continue())
|
|
@@ -1834,8 +1836,11 @@ async def production_aws_iamrole_only(
|
|
|
1834
1836
|
region: str,
|
|
1835
1837
|
bucket_name: str,
|
|
1836
1838
|
environment: str,
|
|
1839
|
+
connection_name: str,
|
|
1837
1840
|
) -> Tuple[str, str, str]:
|
|
1838
|
-
_, trust_policy, external_id = await get_aws_iamrole_policies(
|
|
1841
|
+
_, trust_policy, external_id = await get_aws_iamrole_policies(
|
|
1842
|
+
prod_client, service=service, policy="read", bucket=bucket_name, external_id_seed=connection_name
|
|
1843
|
+
)
|
|
1839
1844
|
|
|
1840
1845
|
trust_policy_copied = True
|
|
1841
1846
|
try:
|
|
@@ -1868,15 +1873,21 @@ async def production_aws_iamrole_only(
|
|
|
1868
1873
|
return role_arn, region, external_id
|
|
1869
1874
|
|
|
1870
1875
|
|
|
1871
|
-
async def get_aws_iamrole_policies(
|
|
1876
|
+
async def get_aws_iamrole_policies(
|
|
1877
|
+
client: TinyB,
|
|
1878
|
+
service: str,
|
|
1879
|
+
policy: str = "write",
|
|
1880
|
+
bucket: Optional[str] = None,
|
|
1881
|
+
external_id_seed: Optional[str] = None,
|
|
1882
|
+
):
|
|
1872
1883
|
access_policy: Dict[str, Any] = {}
|
|
1873
1884
|
if service == DataConnectorType.AMAZON_S3_IAMROLE:
|
|
1874
1885
|
service = DataConnectorType.AMAZON_S3
|
|
1875
1886
|
try:
|
|
1876
1887
|
if policy == "write":
|
|
1877
|
-
access_policy = await client.get_access_write_policy(service)
|
|
1888
|
+
access_policy = await client.get_access_write_policy(service, bucket)
|
|
1878
1889
|
elif policy == "read":
|
|
1879
|
-
access_policy = await client.get_access_read_policy(service)
|
|
1890
|
+
access_policy = await client.get_access_read_policy(service, bucket)
|
|
1880
1891
|
else:
|
|
1881
1892
|
raise Exception(f"Access policy {policy} not supported. Choose from 'read' or 'write'")
|
|
1882
1893
|
if not len(access_policy) > 0:
|
|
@@ -1886,7 +1897,7 @@ async def get_aws_iamrole_policies(client: TinyB, service: str, policy: str = "w
|
|
|
1886
1897
|
|
|
1887
1898
|
trust_policy: Dict[str, Any] = {}
|
|
1888
1899
|
try:
|
|
1889
|
-
trust_policy = await client.get_trust_policy(service)
|
|
1900
|
+
trust_policy = await client.get_trust_policy(service, external_id_seed)
|
|
1890
1901
|
if not len(trust_policy) > 0:
|
|
1891
1902
|
raise Exception(f"{service.upper()} Integration not supported in this region")
|
|
1892
1903
|
except Exception as e:
|
|
@@ -2187,30 +2198,6 @@ async def get_user_token(config: CLIConfig, user_token: Optional[str] = None) ->
|
|
|
2187
2198
|
return user_token
|
|
2188
2199
|
|
|
2189
2200
|
|
|
2190
|
-
def get_ui_url(api_host: str) -> str:
|
|
2191
|
-
"""Transforms API URLs into their corresponding UI URLs.
|
|
2192
|
-
Examples:
|
|
2193
|
-
>>> get_ui_url("http://localhost:8000")
|
|
2194
|
-
'https://cloud.tinybird.co/local/8000'
|
|
2195
|
-
>>> get_ui_url("https://api.europe-west2.gcp.tinybird.co")
|
|
2196
|
-
'https://cloud.tinybird.co/gcp/europe-west2'
|
|
2197
|
-
>>> get_ui_url("https://other-domain.com")
|
|
2198
|
-
'https://other-domain.com'
|
|
2199
|
-
"""
|
|
2200
|
-
if "//localhost" in api_host:
|
|
2201
|
-
port = api_host.split(":")[-1] or "80"
|
|
2202
|
-
return f"https://cloud.tinybird.co/local/{port}"
|
|
2203
|
-
|
|
2204
|
-
if api_host.endswith("tinybird.co") and "api." in api_host:
|
|
2205
|
-
parts = api_host.split(".")
|
|
2206
|
-
if len(parts) >= 4:
|
|
2207
|
-
region = parts[1] or "europe-west2"
|
|
2208
|
-
cloud = parts[2] or "gcp"
|
|
2209
|
-
return f"https://cloud.tinybird.co/{cloud}/{region}"
|
|
2210
|
-
|
|
2211
|
-
return api_host
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
2201
|
async def ask_for_organization(
|
|
2215
2202
|
organizations: Optional[List[Dict[str, Any]]],
|
|
2216
2203
|
organization_id: Optional[str] = None,
|
|
@@ -167,6 +167,7 @@ async def connection_create_s3(ctx: Context) -> None:
|
|
|
167
167
|
client,
|
|
168
168
|
service=service,
|
|
169
169
|
environment=obj["env"],
|
|
170
|
+
connection_name=connection_name,
|
|
170
171
|
)
|
|
171
172
|
unique_suffix = uuid.uuid4().hex[:8] # Use first 8 chars of a UUID for brevity
|
|
172
173
|
secret_name = f"s3_role_arn_{connection_name}_{unique_suffix}"
|
|
@@ -188,7 +189,12 @@ async def connection_create_s3(ctx: Context) -> None:
|
|
|
188
189
|
staging=False,
|
|
189
190
|
)
|
|
190
191
|
prod_role_arn, _, _ = await production_aws_iamrole_only(
|
|
191
|
-
prod_client,
|
|
192
|
+
prod_client,
|
|
193
|
+
service=service,
|
|
194
|
+
region=region,
|
|
195
|
+
bucket_name=bucket_name,
|
|
196
|
+
environment="cloud",
|
|
197
|
+
connection_name=connection_name,
|
|
192
198
|
)
|
|
193
199
|
await prod_client.create_secret(name=secret_name, value=prod_role_arn)
|
|
194
200
|
|
tinybird/tb/modules/open.py
CHANGED
|
@@ -3,8 +3,9 @@ import webbrowser
|
|
|
3
3
|
import click
|
|
4
4
|
from click import Context
|
|
5
5
|
|
|
6
|
+
from tinybird.tb.config import get_display_cloud_host
|
|
6
7
|
from tinybird.tb.modules.cli import cli
|
|
7
|
-
from tinybird.tb.modules.common import coro
|
|
8
|
+
from tinybird.tb.modules.common import coro
|
|
8
9
|
from tinybird.tb.modules.exceptions import CLIException
|
|
9
10
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
10
11
|
from tinybird.tb.modules.local_common import get_build_workspace_name
|
|
@@ -24,7 +25,7 @@ async def open(ctx: Context, workspace: str):
|
|
|
24
25
|
client = ctx.ensure_object(dict)["client"]
|
|
25
26
|
env = ctx.ensure_object(dict)["env"]
|
|
26
27
|
|
|
27
|
-
url_host =
|
|
28
|
+
url_host = get_display_cloud_host(client.host)
|
|
28
29
|
|
|
29
30
|
if not workspace:
|
|
30
31
|
workspace = get_build_workspace_name(config.get("path")) if env == "build" else config.get("name")
|
|
@@ -12,17 +12,17 @@ tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
|
|
|
12
12
|
tinybird/tornado_template.py,sha256=jjNVDMnkYFWXflmT8KU_Ssbo5vR8KQq3EJMk5vYgXRw,41959
|
|
13
13
|
tinybird/ch_utils/constants.py,sha256=aYvg2C_WxYWsnqPdZB1ZFoIr8ZY-XjUXYyHKE9Ansj0,3890
|
|
14
14
|
tinybird/ch_utils/engine.py,sha256=BZuPM7MFS7vaEKK5tOMR2bwSAgJudPrJt27uVEwZmTY,40512
|
|
15
|
-
tinybird/tb/__cli__.py,sha256=
|
|
15
|
+
tinybird/tb/__cli__.py,sha256=1cGs_hmW4A_t0Pyv4jLB4ukdRk4CeneW1ZKTnQ0BBEI,252
|
|
16
16
|
tinybird/tb/cli.py,sha256=uDLwcbwSJfVFw-pceijZJqaq26z5jNsey0QaUGFjt7w,1097
|
|
17
|
-
tinybird/tb/client.py,sha256=
|
|
17
|
+
tinybird/tb/client.py,sha256=oa0pR46WvzDoqpyaDU-lRu33I0cZhtZVDqDQz2RHMWQ,56085
|
|
18
18
|
tinybird/tb/config.py,sha256=3bEyh6sECiAm41L9Nr_ALkvprMyuzvQSvVPrljFbg68,3790
|
|
19
19
|
tinybird/tb/modules/auth.py,sha256=_OeYnmTH83lnqCgQEdS6K0bx1KBUeRmZk2M7JnRmWpk,9037
|
|
20
20
|
tinybird/tb/modules/build.py,sha256=4yP8QJd2YYr1w9XWCSRqB6CztfVzN6gL75p32UYJvdc,15566
|
|
21
21
|
tinybird/tb/modules/cicd.py,sha256=A7zJZF9HkJ6NPokplgNjmefMrpUlRbFxBbjMZhq5OTI,7110
|
|
22
22
|
tinybird/tb/modules/cli.py,sha256=Y_5hu9xwyTIZw4bQoe0MYLnRIzmR7hUjql_oZBxd4Qg,13407
|
|
23
|
-
tinybird/tb/modules/common.py,sha256=
|
|
23
|
+
tinybird/tb/modules/common.py,sha256=J2Wjt1jTVMyUjQfgMKPwBKZ2qjHH8Zw-WvEYz0Kuc7Y,83466
|
|
24
24
|
tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc,11422
|
|
25
|
-
tinybird/tb/modules/connection.py,sha256=
|
|
25
|
+
tinybird/tb/modules/connection.py,sha256=ctrcZCksfBKJHv3pMoDzsmgmx-rlkfeyn2GkxM0Zlw0,6892
|
|
26
26
|
tinybird/tb/modules/copy.py,sha256=2Mm4FWKehOG7CoOhiF1m9UZJgJn0W1_cMolqju8ONYg,5805
|
|
27
27
|
tinybird/tb/modules/create.py,sha256=s0Hx4s4fqqJPlo3Nl2JvybrlaObzBt9ej4Cv5C93HdM,16576
|
|
28
28
|
tinybird/tb/modules/datasource.py,sha256=-aQCK_-wEmoo92Ki7zr2wm424RchDgWvT6yhfFY5kko,16909
|
|
@@ -41,7 +41,7 @@ tinybird/tb/modules/login.py,sha256=rLYdV7MLCTT1F4VBAWGv6SO9efMiM9-977ayLecUzjI,
|
|
|
41
41
|
tinybird/tb/modules/logout.py,sha256=ULooy1cDBD02-r7voZmhV7udA0ML5tVuflJyShrh56Y,1022
|
|
42
42
|
tinybird/tb/modules/materialization.py,sha256=yIns8ypdFVLWwuCcvAZPBChsuJl2DIxJe6M8UCBHNsU,5752
|
|
43
43
|
tinybird/tb/modules/mock.py,sha256=Z_1nYMO8mmjZkBjikqHNqSd4ssdmcfaXUqIh8jY-z6o,4519
|
|
44
|
-
tinybird/tb/modules/open.py,sha256=
|
|
44
|
+
tinybird/tb/modules/open.py,sha256=OuctINN77oexpSjth9uoIZPCelKO4Li-yyVxeSnk1io,1371
|
|
45
45
|
tinybird/tb/modules/pipe.py,sha256=AQKEDagO6e3psPVjJkS_MDbn8aK-apAiLp26k7jgAV0,2432
|
|
46
46
|
tinybird/tb/modules/project.py,sha256=Jpoi-3ybIixN8bHCqOMnuaKByXjrdN_Gvlpa24L-e4U,3124
|
|
47
47
|
tinybird/tb/modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
@@ -79,8 +79,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
|
|
|
79
79
|
tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
|
|
80
80
|
tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
81
81
|
tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
|
|
82
|
-
tinybird-0.0.1.
|
|
83
|
-
tinybird-0.0.1.
|
|
84
|
-
tinybird-0.0.1.
|
|
85
|
-
tinybird-0.0.1.
|
|
86
|
-
tinybird-0.0.1.
|
|
82
|
+
tinybird-0.0.1.dev121.dist-info/METADATA,sha256=uKlfeGHHiFIM2jv7MxwcZfzCON7xyo3ErBcxCbSLKTc,1612
|
|
83
|
+
tinybird-0.0.1.dev121.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
84
|
+
tinybird-0.0.1.dev121.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
85
|
+
tinybird-0.0.1.dev121.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
86
|
+
tinybird-0.0.1.dev121.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|