tinybird 0.0.1.dev244__py3-none-any.whl → 0.0.1.dev246__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.
Potentially problematic release.
This version of tinybird might be problematic. Click here for more details.
- tinybird/datafile/common.py +28 -3
- tinybird/tb/__cli__.py +2 -2
- tinybird/tb/modules/agent/agent.py +63 -20
- tinybird/tb/modules/agent/prompts.py +14 -14
- tinybird/tb/modules/agent/tools/build.py +19 -0
- tinybird/tb/modules/agent/tools/create_datafile.py +3 -3
- tinybird/tb/modules/agent/tools/deploy.py +45 -0
- tinybird/tb/modules/agent/tools/deploy_check.py +19 -0
- tinybird/tb/modules/agent/utils.py +5 -2
- tinybird/tb/modules/deployment.py +9 -381
- tinybird/tb/modules/deployment_common.py +413 -0
- tinybird/tb/modules/feedback_manager.py +7 -6
- {tinybird-0.0.1.dev244.dist-info → tinybird-0.0.1.dev246.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev244.dist-info → tinybird-0.0.1.dev246.dist-info}/RECORD +17 -13
- {tinybird-0.0.1.dev244.dist-info → tinybird-0.0.1.dev246.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev244.dist-info → tinybird-0.0.1.dev246.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev244.dist-info → tinybird-0.0.1.dev246.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import logging
|
|
3
|
+
import sys
|
|
4
|
+
import time
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any, Dict, Optional, Tuple, Union
|
|
7
|
+
|
|
8
|
+
import click
|
|
9
|
+
import requests
|
|
10
|
+
|
|
11
|
+
from tinybird.tb.client import TinyB
|
|
12
|
+
from tinybird.tb.modules.common import (
|
|
13
|
+
echo_safe_humanfriendly_tables_format_smart_table,
|
|
14
|
+
get_display_cloud_host,
|
|
15
|
+
sys_exit,
|
|
16
|
+
)
|
|
17
|
+
from tinybird.tb.modules.feedback_manager import FeedbackManager, bcolors
|
|
18
|
+
from tinybird.tb.modules.project import Project
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# TODO(eclbg): This should eventually end up in client.py, but we're not using it here yet.
|
|
22
|
+
def api_fetch(url: str, headers: dict) -> dict:
|
|
23
|
+
r = requests.get(url, headers=headers)
|
|
24
|
+
if r.status_code == 200:
|
|
25
|
+
logging.debug(json.dumps(r.json(), indent=2))
|
|
26
|
+
return r.json()
|
|
27
|
+
# Try to parse and print the error from the response
|
|
28
|
+
try:
|
|
29
|
+
result = r.json()
|
|
30
|
+
error = result.get("error")
|
|
31
|
+
logging.debug(json.dumps(result, indent=2))
|
|
32
|
+
click.echo(FeedbackManager.error(message=f"Error: {error}"))
|
|
33
|
+
sys_exit("deployment_error", error)
|
|
34
|
+
except Exception:
|
|
35
|
+
message = "Error parsing response from API"
|
|
36
|
+
click.echo(FeedbackManager.error(message=message))
|
|
37
|
+
sys_exit("deployment_error", message)
|
|
38
|
+
return {}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def api_post(
|
|
42
|
+
url: str,
|
|
43
|
+
headers: dict,
|
|
44
|
+
files: Optional[list] = None,
|
|
45
|
+
params: Optional[dict] = None,
|
|
46
|
+
) -> dict:
|
|
47
|
+
r = requests.post(url, headers=headers, files=files, params=params)
|
|
48
|
+
if r.status_code < 300:
|
|
49
|
+
logging.debug(json.dumps(r.json(), indent=2))
|
|
50
|
+
return r.json()
|
|
51
|
+
# Try to parse and print the error from the response
|
|
52
|
+
try:
|
|
53
|
+
result = r.json()
|
|
54
|
+
logging.debug(json.dumps(result, indent=2))
|
|
55
|
+
error = result.get("error")
|
|
56
|
+
if error:
|
|
57
|
+
click.echo(FeedbackManager.error(message=f"Error: {error}"))
|
|
58
|
+
sys_exit("deployment_error", error)
|
|
59
|
+
return result
|
|
60
|
+
except Exception:
|
|
61
|
+
message = "Error parsing response from API"
|
|
62
|
+
click.echo(FeedbackManager.error(message=message))
|
|
63
|
+
sys_exit("deployment_error", message)
|
|
64
|
+
return {}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# TODO(eclbg): This logic should be in the server, and there should be a dedicated endpoint for promoting a deployment
|
|
68
|
+
# potato
|
|
69
|
+
def promote_deployment(host: Optional[str], headers: dict, wait: bool) -> None:
|
|
70
|
+
TINYBIRD_API_URL = f"{host}/v1/deployments"
|
|
71
|
+
result = api_fetch(TINYBIRD_API_URL, headers)
|
|
72
|
+
|
|
73
|
+
deployments = result.get("deployments")
|
|
74
|
+
if not deployments:
|
|
75
|
+
message = "No deployments found"
|
|
76
|
+
click.echo(FeedbackManager.error(message=message))
|
|
77
|
+
sys_exit("deployment_error", message)
|
|
78
|
+
return
|
|
79
|
+
|
|
80
|
+
if len(deployments) < 2:
|
|
81
|
+
message = "Only one deployment found"
|
|
82
|
+
click.echo(FeedbackManager.error(message=message))
|
|
83
|
+
sys_exit("deployment_error", message)
|
|
84
|
+
return
|
|
85
|
+
|
|
86
|
+
last_deployment, candidate_deployment = deployments[0], deployments[1]
|
|
87
|
+
|
|
88
|
+
if candidate_deployment.get("status") != "data_ready":
|
|
89
|
+
click.echo(FeedbackManager.error(message="Current deployment is not ready"))
|
|
90
|
+
deploy_errors = candidate_deployment.get("errors", [])
|
|
91
|
+
for deploy_error in deploy_errors:
|
|
92
|
+
click.echo(FeedbackManager.error(message=f"* {deploy_error}"))
|
|
93
|
+
sys_exit("deployment_error", "Current deployment is not ready: " + str(deploy_errors))
|
|
94
|
+
return
|
|
95
|
+
|
|
96
|
+
if candidate_deployment.get("live"):
|
|
97
|
+
click.echo(FeedbackManager.error(message="Candidate deployment is already live"))
|
|
98
|
+
else:
|
|
99
|
+
TINYBIRD_API_URL = f"{host}/v1/deployments/{candidate_deployment.get('id')}/set-live"
|
|
100
|
+
result = api_post(TINYBIRD_API_URL, headers=headers)
|
|
101
|
+
|
|
102
|
+
click.echo(FeedbackManager.highlight(message="» Removing old deployment"))
|
|
103
|
+
|
|
104
|
+
TINYBIRD_API_URL = f"{host}/v1/deployments/{last_deployment.get('id')}"
|
|
105
|
+
r = requests.delete(TINYBIRD_API_URL, headers=headers)
|
|
106
|
+
result = r.json()
|
|
107
|
+
logging.debug(json.dumps(result, indent=2))
|
|
108
|
+
if result.get("error"):
|
|
109
|
+
click.echo(FeedbackManager.error(message=result.get("error")))
|
|
110
|
+
sys_exit("deployment_error", result.get("error", "Unknown error"))
|
|
111
|
+
click.echo(FeedbackManager.info(message="✓ Old deployment removed"))
|
|
112
|
+
|
|
113
|
+
click.echo(FeedbackManager.highlight(message="» Waiting for deployment to be promoted..."))
|
|
114
|
+
|
|
115
|
+
if wait:
|
|
116
|
+
while True:
|
|
117
|
+
TINYBIRD_API_URL = f"{host}/v1/deployments/{last_deployment.get('id')}"
|
|
118
|
+
result = api_fetch(TINYBIRD_API_URL, headers=headers)
|
|
119
|
+
|
|
120
|
+
last_deployment = result.get("deployment")
|
|
121
|
+
if last_deployment.get("status") == "deleted":
|
|
122
|
+
click.echo(FeedbackManager.success(message=f"✓ Deployment #{candidate_deployment.get('id')} is live!"))
|
|
123
|
+
break
|
|
124
|
+
|
|
125
|
+
time.sleep(5)
|
|
126
|
+
if last_deployment.get("id") == "0":
|
|
127
|
+
# This is the first deployment, so we prompt the user to ingest data
|
|
128
|
+
click.echo(
|
|
129
|
+
FeedbackManager.info(
|
|
130
|
+
message="A deployment with no data is useless. Learn how to ingest at https://www.tinybird.co/docs/forward/get-data-in"
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# TODO(eclbg): This logic should be in the server, and there should be a dedicated endpoint for discarding a
|
|
136
|
+
# deployment
|
|
137
|
+
def discard_deployment(host: Optional[str], headers: dict, wait: bool) -> None:
|
|
138
|
+
TINYBIRD_API_URL = f"{host}/v1/deployments"
|
|
139
|
+
result = api_fetch(TINYBIRD_API_URL, headers=headers)
|
|
140
|
+
|
|
141
|
+
deployments = result.get("deployments")
|
|
142
|
+
if not deployments:
|
|
143
|
+
click.echo(FeedbackManager.error(message="No deployments found"))
|
|
144
|
+
return
|
|
145
|
+
|
|
146
|
+
if len(deployments) < 2:
|
|
147
|
+
click.echo(FeedbackManager.error(message="Only one deployment found"))
|
|
148
|
+
return
|
|
149
|
+
|
|
150
|
+
previous_deployment, current_deployment = deployments[0], deployments[1]
|
|
151
|
+
|
|
152
|
+
if previous_deployment.get("status") != "data_ready":
|
|
153
|
+
click.echo(FeedbackManager.error(message="Previous deployment is not ready"))
|
|
154
|
+
deploy_errors = previous_deployment.get("errors", [])
|
|
155
|
+
for deploy_error in deploy_errors:
|
|
156
|
+
click.echo(FeedbackManager.error(message=f"* {deploy_error}"))
|
|
157
|
+
return
|
|
158
|
+
|
|
159
|
+
if previous_deployment.get("live"):
|
|
160
|
+
click.echo(FeedbackManager.error(message="Previous deployment is already live"))
|
|
161
|
+
else:
|
|
162
|
+
click.echo(FeedbackManager.success(message="Promoting previous deployment"))
|
|
163
|
+
|
|
164
|
+
TINYBIRD_API_URL = f"{host}/v1/deployments/{previous_deployment.get('id')}/set-live"
|
|
165
|
+
result = api_post(TINYBIRD_API_URL, headers=headers)
|
|
166
|
+
|
|
167
|
+
click.echo(FeedbackManager.success(message="Removing current deployment"))
|
|
168
|
+
|
|
169
|
+
TINYBIRD_API_URL = f"{host}/v1/deployments/{current_deployment.get('id')}"
|
|
170
|
+
r = requests.delete(TINYBIRD_API_URL, headers=headers)
|
|
171
|
+
result = r.json()
|
|
172
|
+
logging.debug(json.dumps(result, indent=2))
|
|
173
|
+
if result.get("error"):
|
|
174
|
+
click.echo(FeedbackManager.error(message=result.get("error")))
|
|
175
|
+
sys_exit("deployment_error", result.get("error", "Unknown error"))
|
|
176
|
+
|
|
177
|
+
click.echo(FeedbackManager.success(message="Discard process successfully started"))
|
|
178
|
+
|
|
179
|
+
if wait:
|
|
180
|
+
while True:
|
|
181
|
+
TINYBIRD_API_URL = f"{host}/v1/deployments/{current_deployment.get('id')}"
|
|
182
|
+
result = api_fetch(TINYBIRD_API_URL, headers)
|
|
183
|
+
|
|
184
|
+
current_deployment = result.get("deployment")
|
|
185
|
+
if current_deployment.get("status") == "deleted":
|
|
186
|
+
click.echo(FeedbackManager.success(message="Discard process successfully completed"))
|
|
187
|
+
break
|
|
188
|
+
time.sleep(5)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def create_deployment(
|
|
192
|
+
project: Project,
|
|
193
|
+
client: TinyB,
|
|
194
|
+
config: Dict[str, Any],
|
|
195
|
+
wait: bool,
|
|
196
|
+
auto: bool,
|
|
197
|
+
check: Optional[bool] = None,
|
|
198
|
+
allow_destructive_operations: Optional[bool] = None,
|
|
199
|
+
) -> None:
|
|
200
|
+
# TODO: This code is duplicated in build_server.py
|
|
201
|
+
# Should be refactored to be shared
|
|
202
|
+
MULTIPART_BOUNDARY_DATA_PROJECT = "data_project://"
|
|
203
|
+
DATAFILE_TYPE_TO_CONTENT_TYPE = {
|
|
204
|
+
".datasource": "text/plain",
|
|
205
|
+
".pipe": "text/plain",
|
|
206
|
+
".connection": "text/plain",
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
TINYBIRD_API_URL = f"{client.host}/v1/deploy"
|
|
210
|
+
TINYBIRD_API_KEY = client.token
|
|
211
|
+
|
|
212
|
+
if project.has_deeper_level():
|
|
213
|
+
click.echo(
|
|
214
|
+
FeedbackManager.warning(
|
|
215
|
+
message="\nYour project contains directories nested deeper than the default scan depth (max_depth=3). "
|
|
216
|
+
"Files in these deeper directories will not be processed. "
|
|
217
|
+
"To include all nested directories, run `tb --max-depth <depth> <cmd>` with a higher depth value."
|
|
218
|
+
)
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
files = [
|
|
222
|
+
("context://", ("cli-version", "1.0.0", "text/plain")),
|
|
223
|
+
]
|
|
224
|
+
for file_path in project.get_project_files():
|
|
225
|
+
relative_path = Path(file_path).relative_to(project.path).as_posix()
|
|
226
|
+
with open(file_path, "rb") as fd:
|
|
227
|
+
content_type = DATAFILE_TYPE_TO_CONTENT_TYPE.get(Path(file_path).suffix, "application/unknown")
|
|
228
|
+
files.append((MULTIPART_BOUNDARY_DATA_PROJECT, (relative_path, fd.read().decode("utf-8"), content_type)))
|
|
229
|
+
|
|
230
|
+
deployment = None
|
|
231
|
+
try:
|
|
232
|
+
HEADERS = {"Authorization": f"Bearer {TINYBIRD_API_KEY}"}
|
|
233
|
+
params = {}
|
|
234
|
+
if check:
|
|
235
|
+
click.echo(FeedbackManager.highlight(message="\n» Validating deployment...\n"))
|
|
236
|
+
params["check"] = "true"
|
|
237
|
+
if allow_destructive_operations:
|
|
238
|
+
params["allow_destructive_operations"] = "true"
|
|
239
|
+
|
|
240
|
+
result = api_post(TINYBIRD_API_URL, headers=HEADERS, files=files, params=params)
|
|
241
|
+
|
|
242
|
+
print_changes(result, project)
|
|
243
|
+
|
|
244
|
+
deployment = result.get("deployment", {})
|
|
245
|
+
feedback = deployment.get("feedback", [])
|
|
246
|
+
for f in feedback:
|
|
247
|
+
if f.get("level", "").upper() == "ERROR":
|
|
248
|
+
feedback_func = FeedbackManager.error
|
|
249
|
+
feedback_icon = ""
|
|
250
|
+
else:
|
|
251
|
+
feedback_func = FeedbackManager.warning
|
|
252
|
+
feedback_icon = "△ "
|
|
253
|
+
resource = f.get("resource")
|
|
254
|
+
resource_bit = f"{resource}: " if resource else ""
|
|
255
|
+
click.echo(feedback_func(message=f"{feedback_icon}{f.get('level')}: {resource_bit}{f.get('message')}"))
|
|
256
|
+
|
|
257
|
+
deploy_errors = deployment.get("errors")
|
|
258
|
+
for deploy_error in deploy_errors:
|
|
259
|
+
if deploy_error.get("filename", None):
|
|
260
|
+
click.echo(
|
|
261
|
+
FeedbackManager.error(message=f"{deploy_error.get('filename')}\n\n{deploy_error.get('error')}")
|
|
262
|
+
)
|
|
263
|
+
else:
|
|
264
|
+
click.echo(FeedbackManager.error(message=f"{deploy_error.get('error')}"))
|
|
265
|
+
click.echo("") # For spacing
|
|
266
|
+
|
|
267
|
+
status = result.get("result")
|
|
268
|
+
if check:
|
|
269
|
+
if status == "success":
|
|
270
|
+
click.echo(FeedbackManager.success(message="\n✓ Deployment is valid"))
|
|
271
|
+
sys.exit(0)
|
|
272
|
+
elif status == "no_changes":
|
|
273
|
+
sys.exit(0)
|
|
274
|
+
|
|
275
|
+
click.echo(FeedbackManager.error(message="\n✗ Deployment is not valid"))
|
|
276
|
+
sys_exit(
|
|
277
|
+
"deployment_error",
|
|
278
|
+
f"Deployment is not valid: {str(deployment.get('errors') + deployment.get('feedback', []))}",
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
status = result.get("result")
|
|
282
|
+
if status == "success":
|
|
283
|
+
host = get_display_cloud_host(client.host)
|
|
284
|
+
click.echo(
|
|
285
|
+
FeedbackManager.info(message="Deployment URL: ")
|
|
286
|
+
+ f"{bcolors.UNDERLINE}{host}/{config.get('name')}/deployments/{deployment.get('id')}{bcolors.ENDC}"
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
if wait:
|
|
290
|
+
click.echo(FeedbackManager.info(message="\n* Deployment submitted"))
|
|
291
|
+
else:
|
|
292
|
+
click.echo(FeedbackManager.success(message="\n✓ Deployment submitted successfully"))
|
|
293
|
+
elif status == "no_changes":
|
|
294
|
+
click.echo(FeedbackManager.warning(message="△ Not deploying. No changes."))
|
|
295
|
+
sys.exit(0)
|
|
296
|
+
elif status == "failed":
|
|
297
|
+
click.echo(FeedbackManager.error(message="Deployment failed"))
|
|
298
|
+
sys_exit(
|
|
299
|
+
"deployment_error",
|
|
300
|
+
f"Deployment failed. Errors: {str(deployment.get('errors') + deployment.get('feedback', []))}",
|
|
301
|
+
)
|
|
302
|
+
else:
|
|
303
|
+
click.echo(FeedbackManager.error(message=f"Unknown deployment result {status}"))
|
|
304
|
+
except Exception as e:
|
|
305
|
+
click.echo(FeedbackManager.error_exception(error=e))
|
|
306
|
+
|
|
307
|
+
if not deployment and not check:
|
|
308
|
+
sys_exit("deployment_error", "Deployment failed")
|
|
309
|
+
|
|
310
|
+
if deployment and wait and not check:
|
|
311
|
+
click.echo(FeedbackManager.highlight(message="» Waiting for deployment to be ready..."))
|
|
312
|
+
while True:
|
|
313
|
+
url = f"{client.host}/v1/deployments/{deployment.get('id')}"
|
|
314
|
+
res = api_fetch(url, HEADERS)
|
|
315
|
+
deployment = res.get("deployment")
|
|
316
|
+
if not deployment:
|
|
317
|
+
click.echo(FeedbackManager.error(message="Error parsing deployment from response"))
|
|
318
|
+
sys_exit("deployment_error", "Error parsing deployment from response")
|
|
319
|
+
if deployment.get("status") == "failed":
|
|
320
|
+
click.echo(FeedbackManager.error(message="Deployment failed"))
|
|
321
|
+
deploy_errors = deployment.get("errors")
|
|
322
|
+
for deploy_error in deploy_errors:
|
|
323
|
+
click.echo(FeedbackManager.error(message=f"* {deploy_error}"))
|
|
324
|
+
|
|
325
|
+
if auto:
|
|
326
|
+
click.echo(FeedbackManager.error(message="Rolling back deployment"))
|
|
327
|
+
discard_deployment(client.host, HEADERS, wait=wait)
|
|
328
|
+
sys_exit(
|
|
329
|
+
"deployment_error",
|
|
330
|
+
f"Deployment failed. Errors: {str(deployment.get('errors') + deployment.get('feedback', []))}",
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
if deployment.get("status") == "data_ready":
|
|
334
|
+
break
|
|
335
|
+
|
|
336
|
+
if deployment.get("status") in ["deleting", "deleted"]:
|
|
337
|
+
click.echo(FeedbackManager.error(message="Deployment was deleted by another process"))
|
|
338
|
+
sys_exit("deployment_error", "Deployment was deleted by another process")
|
|
339
|
+
|
|
340
|
+
time.sleep(5)
|
|
341
|
+
|
|
342
|
+
click.echo(FeedbackManager.info(message="✓ Deployment is ready"))
|
|
343
|
+
|
|
344
|
+
if auto:
|
|
345
|
+
promote_deployment(client.host, HEADERS, wait=wait)
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def print_changes(result: dict, project: Project) -> None:
|
|
349
|
+
deployment = result.get("deployment", {})
|
|
350
|
+
resources_columns = ["status", "name", "type", "path"]
|
|
351
|
+
resources: list[list[Union[str, None]]] = []
|
|
352
|
+
tokens_columns = ["Change", "Token name", "Added permissions", "Removed permissions"]
|
|
353
|
+
tokens: list[Tuple[str, str, str, str]] = []
|
|
354
|
+
|
|
355
|
+
for ds in deployment.get("new_datasource_names", []):
|
|
356
|
+
resources.append(["new", ds, "datasource", project.get_resource_path(ds, "datasource")])
|
|
357
|
+
|
|
358
|
+
for p in deployment.get("new_pipe_names", []):
|
|
359
|
+
path = project.get_resource_path(p, "pipe")
|
|
360
|
+
pipe_type = project.get_pipe_type(path)
|
|
361
|
+
resources.append(["new", p, pipe_type, path])
|
|
362
|
+
|
|
363
|
+
for dc in deployment.get("new_data_connector_names", []):
|
|
364
|
+
resources.append(["new", dc, "connection", project.get_resource_path(dc, "connection")])
|
|
365
|
+
|
|
366
|
+
for ds in deployment.get("changed_datasource_names", []):
|
|
367
|
+
resources.append(["modified", ds, "datasource", project.get_resource_path(ds, "datasource")])
|
|
368
|
+
|
|
369
|
+
for p in deployment.get("changed_pipe_names", []):
|
|
370
|
+
path = project.get_resource_path(p, "pipe")
|
|
371
|
+
pipe_type = project.get_pipe_type(path)
|
|
372
|
+
resources.append(["modified", p, pipe_type, path])
|
|
373
|
+
|
|
374
|
+
for dc in deployment.get("changed_data_connector_names", []):
|
|
375
|
+
resources.append(["modified", dc, "connection", project.get_resource_path(dc, "connection")])
|
|
376
|
+
|
|
377
|
+
for ds in deployment.get("disconnected_data_source_names", []):
|
|
378
|
+
resources.append(["modified", ds, "datasource", project.get_resource_path(ds, "datasource")])
|
|
379
|
+
|
|
380
|
+
for ds in deployment.get("deleted_datasource_names", []):
|
|
381
|
+
resources.append(["deleted", ds, "datasource", project.get_resource_path(ds, "datasource")])
|
|
382
|
+
|
|
383
|
+
for p in deployment.get("deleted_pipe_names", []):
|
|
384
|
+
path = project.get_resource_path(p, "pipe")
|
|
385
|
+
pipe_type = project.get_pipe_type(path)
|
|
386
|
+
resources.append(["deleted", p, pipe_type, path])
|
|
387
|
+
|
|
388
|
+
for dc in deployment.get("deleted_data_connector_names", []):
|
|
389
|
+
resources.append(["deleted", dc, "connection", project.get_resource_path(dc, "connection")])
|
|
390
|
+
|
|
391
|
+
for token_change in deployment.get("token_changes", []):
|
|
392
|
+
token_name = token_change.get("token_name")
|
|
393
|
+
change_type = token_change.get("change_type")
|
|
394
|
+
added_perms = []
|
|
395
|
+
removed_perms = []
|
|
396
|
+
permission_changes = token_change.get("permission_changes", {})
|
|
397
|
+
for perm in permission_changes.get("added_permissions", []):
|
|
398
|
+
added_perms.append(f"{perm['resource_name']}.{perm['resource_type']}:{perm['permission']}")
|
|
399
|
+
for perm in permission_changes.get("removed_permissions", []):
|
|
400
|
+
removed_perms.append(f"{perm['resource_name']}.{perm['resource_type']}:{perm['permission']}")
|
|
401
|
+
|
|
402
|
+
tokens.append((change_type, token_name, "\n".join(added_perms), "\n".join(removed_perms)))
|
|
403
|
+
|
|
404
|
+
if resources:
|
|
405
|
+
click.echo(FeedbackManager.info(message="\n* Changes to be deployed:"))
|
|
406
|
+
echo_safe_humanfriendly_tables_format_smart_table(resources, column_names=resources_columns)
|
|
407
|
+
else:
|
|
408
|
+
click.echo(FeedbackManager.gray(message="\n* No changes to be deployed"))
|
|
409
|
+
if tokens:
|
|
410
|
+
click.echo(FeedbackManager.info(message="\n* Changes in tokens to be deployed:"))
|
|
411
|
+
echo_safe_humanfriendly_tables_format_smart_table(tokens, column_names=tokens_columns)
|
|
412
|
+
else:
|
|
413
|
+
click.echo(FeedbackManager.gray(message="* No changes in tokens to be deployed"))
|
|
@@ -631,12 +631,13 @@ STEP 2: CREATE GCP SERVICE ACCOUNT
|
|
|
631
631
|
1. Go to IAM & Admin > Service Accounts > + Create Service Account: https://console.cloud.google.com/iam-admin/serviceaccounts/create
|
|
632
632
|
2. Provide a service account name. Name the service account something meaningful (e.g., TinybirdGCS-{environment}-svc-account)
|
|
633
633
|
3. Click "Create and continue"
|
|
634
|
-
4. Click the "Select a role" drop down menu
|
|
635
|
-
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
634
|
+
4. Click the "Select a role" drop down menu:
|
|
635
|
+
- For Source (reading from GCS) select this role:
|
|
636
|
+
• "Storage Object Viewer" - Grants access to view objects and their metadata
|
|
637
|
+
- For Sink (writing to GCS) select all three roles:
|
|
638
|
+
• "Storage Object Creator" - Allows users to create objects
|
|
639
|
+
• "Storage Object Viewer" - Grants access to view objects and their metadata
|
|
640
|
+
• "Storage Bucket Viewer" - Grants access to view buckets and their metadata
|
|
640
641
|
(You can add IAM condition to provide access to selected buckets. More info in IAM Conditions: https://cloud.google.com/iam/docs/conditions-overview)
|
|
641
642
|
5. Click "Done"
|
|
642
643
|
"""
|
|
@@ -12,12 +12,12 @@ 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=yEKR11gLCL-irEXXF9QwShaR0JLXiBTlaxfolcCIoqY,4097
|
|
14
14
|
tinybird/ch_utils/engine.py,sha256=X4tE9OrfaUy6kO9cqVEzyI9cDcmOF3IAssRRzsTsfEQ,40781
|
|
15
|
-
tinybird/datafile/common.py,sha256=
|
|
15
|
+
tinybird/datafile/common.py,sha256=J0Oydru3Nh3oCx66EEEHGxm2-r5_NfxvZxiFhBjgAH0,98428
|
|
16
16
|
tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1wnI,556
|
|
17
17
|
tinybird/datafile/parse_connection.py,sha256=tRyn2Rpr1TeWet5BXmMoQgaotbGdYep1qiTak_OqC5E,1825
|
|
18
18
|
tinybird/datafile/parse_datasource.py,sha256=ssW8QeFSgglVFi3sDZj_HgkJiTJ2069v2JgqnH3CkDE,1825
|
|
19
19
|
tinybird/datafile/parse_pipe.py,sha256=xf4m0Tw44QWJzHzAm7Z7FwUoUUtr7noMYjU1NiWnX0k,3880
|
|
20
|
-
tinybird/tb/__cli__.py,sha256=
|
|
20
|
+
tinybird/tb/__cli__.py,sha256=l43j0Pq0RUILb2kz7n3-G_Tbv8BEXXsW3BaMgzwCouk,247
|
|
21
21
|
tinybird/tb/check_pypi.py,sha256=Gp0HkHHDFMSDL6nxKlOY51z7z1Uv-2LRexNTZSHHGmM,552
|
|
22
22
|
tinybird/tb/cli.py,sha256=FdDFEIayjmsZEVsVSSvRiVYn_FHOVg_zWQzchnzfWho,1008
|
|
23
23
|
tinybird/tb/client.py,sha256=pJbdkWMXGAqKseNAvdsRRnl_c7I-DCMB0dWCQnG82nU,54146
|
|
@@ -32,12 +32,13 @@ tinybird/tb/modules/connection.py,sha256=-MY56NUAai6EMC4-wpi7bT0_nz_SA8QzTmHkV7H
|
|
|
32
32
|
tinybird/tb/modules/copy.py,sha256=dPZkcIDvxjJrlQUIvToO0vsEEEs4EYumbNV77-BzNoU,4404
|
|
33
33
|
tinybird/tb/modules/create.py,sha256=YYE9Bjqc000QGMmDnCG1UDTPs-Qeljr_RlGqM4RrPCA,23244
|
|
34
34
|
tinybird/tb/modules/datasource.py,sha256=cxq0VVjjidxq-v_JSIIAH7L90XNRctgNKsHRoQ_42OI,41632
|
|
35
|
-
tinybird/tb/modules/deployment.py,sha256=
|
|
35
|
+
tinybird/tb/modules/deployment.py,sha256=Fw9wSNqmLBGCpKwmZsn3KPsy-6kmQzI8YzSdXWoDb6k,12046
|
|
36
|
+
tinybird/tb/modules/deployment_common.py,sha256=Y0r3g-3d6AcihsVVa0OHer3ow3xHSV1VPskF1eI03KI,17644
|
|
36
37
|
tinybird/tb/modules/deprecations.py,sha256=rrszC1f_JJeJ8mUxGoCxckQTJFBCR8wREf4XXXN-PRc,4507
|
|
37
38
|
tinybird/tb/modules/dev_server.py,sha256=57FCKuWpErwYUYgHspYDkLWEm9F4pbvVOtMrFXX1fVU,10129
|
|
38
39
|
tinybird/tb/modules/endpoint.py,sha256=ksRj6mfDb9Xv63PhTkV_uKSosgysHElqagg3RTt21Do,11958
|
|
39
40
|
tinybird/tb/modules/exceptions.py,sha256=5jK91w1LPmtqIUfDpHe_Op5OxGz8-p1BPgtLREMIni0,5217
|
|
40
|
-
tinybird/tb/modules/feedback_manager.py,sha256=
|
|
41
|
+
tinybird/tb/modules/feedback_manager.py,sha256=Z8RyINWiPq_z-59oIZQW1qzFfHzU5JHbL09NVzhngb0,78029
|
|
41
42
|
tinybird/tb/modules/info.py,sha256=F5vY4kHS_kyO2uSBKac92HoOb447oDeRlzpwtAHTuKc,6872
|
|
42
43
|
tinybird/tb/modules/infra.py,sha256=JE9oLIyF4bi_JBoe-BgZ5HhKp_lQgSihuSV1KIS02Qs,32709
|
|
43
44
|
tinybird/tb/modules/job.py,sha256=wBsnu8UPTOha2rkLvucgmw4xYv73ubmui3eeSIF68ZM,3107
|
|
@@ -65,15 +66,18 @@ tinybird/tb/modules/watch.py,sha256=No0bK1M1_3CYuMaIgylxf7vYFJ72lTJe3brz6xQ-mJo,
|
|
|
65
66
|
tinybird/tb/modules/workspace.py,sha256=Q_8HcxMsNg8QG9aBlwcWS2umrDP5IkTIHqqz3sfmGuc,11341
|
|
66
67
|
tinybird/tb/modules/workspace_members.py,sha256=5JdkJgfuEwbq-t6vxkBhYwgsiTDxF790wsa6Xfif9nk,8608
|
|
67
68
|
tinybird/tb/modules/agent/__init__.py,sha256=i3oe3vDIWWPaicdCM0zs7D7BJ1W0k7th93ooskHAV00,54
|
|
68
|
-
tinybird/tb/modules/agent/agent.py,sha256=
|
|
69
|
+
tinybird/tb/modules/agent/agent.py,sha256=q6XMPQifrBpLFDja9SSSNZe2ExBjNETPzva3sn_ofsw,13713
|
|
69
70
|
tinybird/tb/modules/agent/animations.py,sha256=z0MNLf8TnUO8qAjgYvth_wc9a9283pNVz1Z4jl15Ggs,2558
|
|
70
71
|
tinybird/tb/modules/agent/banner.py,sha256=KX_e467uiy1gWOZ4ofTZt0GCFGQqHQ_8Ob27XLQqda0,3053
|
|
71
72
|
tinybird/tb/modules/agent/memory.py,sha256=H6SJK--2L5C87B7AJd_jMqsq3sCvFvZwZXmajuT0GBE,1171
|
|
72
73
|
tinybird/tb/modules/agent/models.py,sha256=mf8dRCdof6uEFZWh5xQ_D_FStk7eDds7qWRNSbDklUM,589
|
|
73
|
-
tinybird/tb/modules/agent/prompts.py,sha256=
|
|
74
|
-
tinybird/tb/modules/agent/utils.py,sha256=
|
|
74
|
+
tinybird/tb/modules/agent/prompts.py,sha256=rh0xqquzkwogdUmS9ychnKIcFT0YNzRPcZBZCug4Ow8,5760
|
|
75
|
+
tinybird/tb/modules/agent/utils.py,sha256=tLndW0MFtC9tS9Am1XfoYOvtPnrrumyMm22ZWVK6XNQ,13263
|
|
75
76
|
tinybird/tb/modules/agent/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
|
-
tinybird/tb/modules/agent/tools/
|
|
77
|
+
tinybird/tb/modules/agent/tools/build.py,sha256=oWrHrHU05JbE5RZY_EYEUcHiUVJlDQbNG8hhDxBuWGs,676
|
|
78
|
+
tinybird/tb/modules/agent/tools/create_datafile.py,sha256=zNqjrpMJFGXvto5KBRWy7Ek9jjLyS6EgjtrpmR4gc80,2383
|
|
79
|
+
tinybird/tb/modules/agent/tools/deploy.py,sha256=_xcP6F4ZIzvxgqi4jV_EkVy0UeHZtNWscGCAeWxvzqU,1402
|
|
80
|
+
tinybird/tb/modules/agent/tools/deploy_check.py,sha256=VqMYC7l3_cihmmM_pi8w1t8rJ3P0xDc7pHs_st9k-9Q,684
|
|
77
81
|
tinybird/tb/modules/agent/tools/explore.py,sha256=ihALc_kBcsjrKT3hZyicqyIowB0g_K3AtNNi-5uz9-8,412
|
|
78
82
|
tinybird/tb/modules/agent/tools/plan.py,sha256=CMSGrqjdVyhsJ0U1M5B2eRFLZXE7HqJ4K8tl1Ile0f0,1324
|
|
79
83
|
tinybird/tb/modules/agent/tools/preview_datafile.py,sha256=e9q5fR0afApcrntzFrnuHmd10ex7MG_GM6T0Pwc9bRI,850
|
|
@@ -97,8 +101,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
|
|
|
97
101
|
tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
|
|
98
102
|
tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
99
103
|
tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
|
|
100
|
-
tinybird-0.0.1.
|
|
101
|
-
tinybird-0.0.1.
|
|
102
|
-
tinybird-0.0.1.
|
|
103
|
-
tinybird-0.0.1.
|
|
104
|
-
tinybird-0.0.1.
|
|
104
|
+
tinybird-0.0.1.dev246.dist-info/METADATA,sha256=io9aiUes21l9HWrsbDwhd88amU_HJnkKl6pleH0s5u4,1733
|
|
105
|
+
tinybird-0.0.1.dev246.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
106
|
+
tinybird-0.0.1.dev246.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
107
|
+
tinybird-0.0.1.dev246.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
108
|
+
tinybird-0.0.1.dev246.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|