tinybird 0.0.1.dev122__py3-none-any.whl → 0.0.1.dev124__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/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.dev122'
8
- __revision__ = '2212d5c'
7
+ __version__ = '0.0.1.dev124'
8
+ __revision__ = '325c83b'
tinybird/tb/config.py CHANGED
@@ -65,6 +65,10 @@ async def get_config(
65
65
  config["host"] = host or config.get("host", DEFAULT_API_HOST)
66
66
  config["workspaces"] = config.get("workspaces", [])
67
67
  config["cwd"] = config.get("cwd", getcwd())
68
+ config["user_email"] = config.get("user_email", None)
69
+ config["user_id"] = config.get("user_id", None)
70
+ config["workspace_id"] = config.get("id", None)
71
+ config["workspace_name"] = config.get("name", None)
68
72
  return config
69
73
 
70
74
 
@@ -103,6 +103,8 @@ def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str
103
103
 
104
104
  logging.debug(json.dumps(result, indent=2))
105
105
 
106
+ output_pre_formatted = False
107
+
106
108
  build_result = result.get("result")
107
109
  if build_result == "success":
108
110
  build = result.get("build")
@@ -157,12 +159,14 @@ def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str
157
159
  )
158
160
  elif build_result == "failed":
159
161
  build_errors = result.get("errors")
160
- error_msg = None
162
+ full_error_msg = ""
161
163
  for build_error in build_errors:
162
- filename_bit = f"{build_error.get('filename', '')}"
164
+ output_pre_formatted = True
165
+ filename_bit = FeedbackManager.build_result_error_title(message=f"{build_error.get('filename', '')}")
163
166
  error_bit = build_error.get("error") or build_error.get("message") or ""
164
- error_msg = ((filename_bit + "\n\n") if filename_bit else "") + error_bit
165
- error = error_msg or "Unknown build error"
167
+ error_msg = ((filename_bit + "\n") if filename_bit else "") + error_bit
168
+ full_error_msg += error_msg + "\n\n"
169
+ error = full_error_msg.strip("\n") or "Unknown build error"
166
170
  else:
167
171
  error = f"Unknown build result. Error: {result.get('error')}"
168
172
  except Exception as e:
@@ -171,7 +175,10 @@ def build_project(project: Project, tb_client: TinyB, file_changed: Optional[str
171
175
  for fd in fds:
172
176
  fd.close()
173
177
  if error:
174
- raise click.ClickException(error)
178
+ if not output_pre_formatted:
179
+ raise click.ClickException(error)
180
+ click.echo(error)
181
+ raise click.ClickException("") # Needed so the caller shows the right message
175
182
 
176
183
 
177
184
  def append_fixture(
@@ -267,7 +274,7 @@ def process(
267
274
 
268
275
  rebuild_str = "Rebuild" if watch and file_changed else "Build"
269
276
  if build_failed:
270
- click.echo(FeedbackManager.error(message=f"\n✗ {rebuild_str} failed"))
277
+ click.echo(FeedbackManager.error(message=f"✗ {rebuild_str} failed"))
271
278
  if not watch:
272
279
  sys.exit(1)
273
280
  else:
@@ -243,7 +243,7 @@ class CatchAuthExceptions(AliasedGroup):
243
243
  formatter.write_heading("Telemetry")
244
244
  formatter.write_text(
245
245
  """
246
- Tinybird collects anonymous usage data and errors to improve the command
246
+ Tinybird collects usage data and errors to improve the command
247
247
  line experience. To opt-out, set TB_CLI_TELEMETRY_OPTOUT to '1' or 'true'."""
248
248
  )
249
249
  formatter.write_paragraph()
@@ -88,7 +88,8 @@ async def create(
88
88
  click.echo(FeedbackManager.success(message="✓ Scaffolding completed!\n"))
89
89
  created_something = True
90
90
  result = ""
91
- if (data or prompt) and user_token:
91
+
92
+ if data or (prompt and user_token):
92
93
  click.echo(FeedbackManager.highlight(message="\n» Creating resources..."))
93
94
  result, created_something = await create_resources(
94
95
  local_client, tb_client, user_token, data, prompt, folder
@@ -1535,6 +1535,8 @@ def parse(
1535
1535
  "kafka_store_raw_value": assign_var("kafka_store_raw_value"),
1536
1536
  "kafka_store_headers": assign_var("kafka_store_headers"),
1537
1537
  "kafka_store_binary_headers": assign_var("kafka_store_binary_headers"),
1538
+ "kafka_key_format": assign_var("kafka_key_format"),
1539
+ "kafka_value_format": assign_var("kafka_key_format"),
1538
1540
  "kafka_key_avro_deserialization": kafka_key_avro_deserialization,
1539
1541
  "kafka_ssl_ca_pem": assign_var("kafka_ssl_ca_pem"),
1540
1542
  "kafka_security_protocol": assign_var("kafka_security_protocol"),
@@ -1150,3 +1150,4 @@ Please enter the ARN of the role you just created"""
1150
1150
  error = error_message("{message}")
1151
1151
  gray = gray_message("{message}")
1152
1152
  warning = warning_message("{message}")
1153
+ build_result_error_title = print_message("\033[91m{message}", bcolors.BOLD)
@@ -1,4 +1,5 @@
1
1
  import functools
2
+ import hashlib
2
3
  import json
3
4
  import os
4
5
  import platform
@@ -13,7 +14,8 @@ from urllib.parse import urlencode
13
14
 
14
15
  import requests
15
16
 
16
- from tinybird.tb.config import CURRENT_VERSION
17
+ from tinybird.syncasync import async_to_sync
18
+ from tinybird.tb.config import CURRENT_VERSION, get_config
17
19
 
18
20
  TELEMETRY_TIMEOUT: int = 1
19
21
  TELEMETRY_DATASOURCE: str = "tb_cli_telemetry"
@@ -80,7 +82,11 @@ def _hide_tokens(text: str) -> str:
80
82
 
81
83
 
82
84
  class TelemetryHelper:
83
- def __init__(self, tb_host: Optional[str] = None, max_enqueued_events: int = 5) -> None:
85
+ def __init__(
86
+ self,
87
+ tb_host: Optional[str] = None,
88
+ max_enqueued_events: int = 5,
89
+ ) -> None:
84
90
  self.tb_host = tb_host or os.getenv("TB_CLI_TELEMETRY_HOST", "https://api.tinybird.co")
85
91
  self.max_enqueued_events: int = max_enqueued_events
86
92
 
@@ -112,6 +118,15 @@ class TelemetryHelper:
112
118
  self.log("Not sending events in local development mode")
113
119
  return
114
120
 
121
+ event_data["fingerprint_id"] = hashlib.sha256(platform.node().encode()).hexdigest()
122
+
123
+ config = async_to_sync(get_config)(None, None)
124
+ if config:
125
+ event_data["workspace_id"] = config.get("workspace_id", "")
126
+ event_data["workspace_name"] = config.get("workspace_name", "")
127
+ event_data["user_email"] = config.get("user_email", "")
128
+ event_data["user_id"] = config.get("user_id", "")
129
+
115
130
  # Let's save deep copies to not interfere with original objects
116
131
  event_dict: Dict[str, Any] = deepcopy(self._defaults)
117
132
  event_dict["event"] = event
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev122
3
+ Version: 0.0.1.dev124
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -12,24 +12,24 @@ 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=Oo7cwqVzKzr6tu9MxOCBZW_iDdHgMq6VAyQHaHaWlHw,252
15
+ tinybird/tb/__cli__.py,sha256=yRgIZndvTr1rfUOaK4rUcrgoA1LsLCDprVp8u7BjOKs,252
16
16
  tinybird/tb/cli.py,sha256=uDLwcbwSJfVFw-pceijZJqaq26z5jNsey0QaUGFjt7w,1097
17
17
  tinybird/tb/client.py,sha256=oa0pR46WvzDoqpyaDU-lRu33I0cZhtZVDqDQz2RHMWQ,56085
18
- tinybird/tb/config.py,sha256=3bEyh6sECiAm41L9Nr_ALkvprMyuzvQSvVPrljFbg68,3790
18
+ tinybird/tb/config.py,sha256=iIia7F67UI9p51Ja4jALonyttIi4eH7PwOn3HvcvOb8,4008
19
19
  tinybird/tb/modules/auth.py,sha256=_OeYnmTH83lnqCgQEdS6K0bx1KBUeRmZk2M7JnRmWpk,9037
20
- tinybird/tb/modules/build.py,sha256=vNTrSSYRNtzqctKsATztDGCZGSYxGCfZUrLxb-pyJHI,15565
20
+ tinybird/tb/modules/build.py,sha256=9O6SzOSe2kPWFSjvSYlBV17Db14MeVQpHY952knArx0,15932
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=J2Wjt1jTVMyUjQfgMKPwBKZ2qjHH8Zw-WvEYz0Kuc7Y,83466
23
+ tinybird/tb/modules/common.py,sha256=bdKNjHtQKcsZFyZIsLY8vEoTD0Xf-1UNBnh1pAyWPZU,83456
24
24
  tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc,11422
25
25
  tinybird/tb/modules/connection.py,sha256=ctrcZCksfBKJHv3pMoDzsmgmx-rlkfeyn2GkxM0Zlw0,6892
26
26
  tinybird/tb/modules/copy.py,sha256=2Mm4FWKehOG7CoOhiF1m9UZJgJn0W1_cMolqju8ONYg,5805
27
- tinybird/tb/modules/create.py,sha256=s0Hx4s4fqqJPlo3Nl2JvybrlaObzBt9ej4Cv5C93HdM,16576
27
+ tinybird/tb/modules/create.py,sha256=CGQBcHk6HVUguCEZ_7VHgnfEOkB38kuC0YvzuUufU1k,16577
28
28
  tinybird/tb/modules/datasource.py,sha256=-aQCK_-wEmoo92Ki7zr2wm424RchDgWvT6yhfFY5kko,16909
29
29
  tinybird/tb/modules/deployment.py,sha256=4Zt7jPbqt18fB5kPx7DbO91Bh6xzBBTEUFY7O89shuU,19560
30
30
  tinybird/tb/modules/endpoint.py,sha256=XySDt3pk66vxOZ0egUfz4bY8bEk3BjOXkv-L0OIJ3sc,12083
31
31
  tinybird/tb/modules/exceptions.py,sha256=4A2sSjCEqKUMqpP3WI00zouCWW4uLaghXXLZBSw04mY,3363
32
- tinybird/tb/modules/feedback_manager.py,sha256=7GH_Rob23L74UMQ2uG9_bZs1JSyg2W_T2dMAjSYOuPo,74099
32
+ tinybird/tb/modules/feedback_manager.py,sha256=8I6n5JFPS4xP-Pfb9iu7hqx5VX773uGDXH2E5QeANeg,74179
33
33
  tinybird/tb/modules/fmt.py,sha256=qpf9APqKTKL2uphNgdbj4OMVyLkAxZn6dn4eHF99L5g,3553
34
34
  tinybird/tb/modules/infra.py,sha256=eX0StUipaXaxIhMxO82cnAnFKTCa7EPOt-e8pWoSLX0,33206
35
35
  tinybird/tb/modules/job.py,sha256=n4dSSBgnA8NqD7srGahf2xRj6wxkmX9Vl0J-QJ_a2w0,2966
@@ -49,7 +49,7 @@ tinybird/tb/modules/secret.py,sha256=rhCRxHKSiUZ4iYY5_EKH57iHzA2mZtjCyuHRsQcA-DY
49
49
  tinybird/tb/modules/shell.py,sha256=cvT0EKpnSRHfuo3avykBRMsCwLBqmzSR7sNUdbQ6lXA,14116
50
50
  tinybird/tb/modules/table.py,sha256=4XrtjM-N0zfNtxVkbvLDQQazno1EPXnxTyo7llivfXk,11035
51
51
  tinybird/tb/modules/tag.py,sha256=anPmMUBc-TbFovlpFi8GPkKA18y7Y0GczMsMms5TZsU,3502
52
- tinybird/tb/modules/telemetry.py,sha256=KEvjbzUsyz3zrNewJLkxoNHRrVJcb4jtkGfIfVLfgfs,10452
52
+ tinybird/tb/modules/telemetry.py,sha256=C-aEXY3yQMHzFFySwefwyigprcmjoz_CiCXv17jpCPA,11001
53
53
  tinybird/tb/modules/test.py,sha256=HxkSpdLOW8brGUNsqdBoSW8RixxyC7OCDmYwEZsIpfs,11459
54
54
  tinybird/tb/modules/token.py,sha256=2fmKwu10_M0pqs6YmJVeILR9ZQB0ejRAET86agASbKM,13488
55
55
  tinybird/tb/modules/watch.py,sha256=poNJOUNDESDNn80H2dHvE6X6pIu-t9MZFi59_TxVN2U,8822
@@ -59,7 +59,7 @@ tinybird/tb/modules/datafile/build.py,sha256=d_h3pRFDPFrDKGhpFx2iejY25GuB2k8yfNo
59
59
  tinybird/tb/modules/datafile/build_common.py,sha256=LU24kAQmxDJIyoIapDaYG-SU3P4FrMG9UBf8m9PgVSI,4565
60
60
  tinybird/tb/modules/datafile/build_datasource.py,sha256=nXEQ0qHdq2ai7jJTv8H2d7eeDPBYzLn8VY7zMtOYb8M,17382
61
61
  tinybird/tb/modules/datafile/build_pipe.py,sha256=6Cwjf3BKEF3-oQ9PipsQfK-Z43nSwtA4qJAUoysI7Uc,11385
62
- tinybird/tb/modules/datafile/common.py,sha256=6yAZyMChNaR5bLjCpPhgEpJUllgZ_SthdTZmUgf0YzU,85320
62
+ tinybird/tb/modules/datafile/common.py,sha256=FXwHfCknNgZnMGaiju4u7ODYnXticP5cVagxor5F7Dw,85442
63
63
  tinybird/tb/modules/datafile/diff.py,sha256=MTmj53RYjER4neLgWVjabn-FKVFgh8h8uYiBo55lFQg,6757
64
64
  tinybird/tb/modules/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1wnI,556
65
65
  tinybird/tb/modules/datafile/fixture.py,sha256=V3WGfPLIR78el3oCNWNkySWs6LxIufyIM0mDrrT3aWc,1131
@@ -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.dev122.dist-info/METADATA,sha256=HpwGTwnv_wbGFBtuqQvt-DgJwysrb93Z0DblQh-HqTo,1612
83
- tinybird-0.0.1.dev122.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
84
- tinybird-0.0.1.dev122.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
85
- tinybird-0.0.1.dev122.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
86
- tinybird-0.0.1.dev122.dist-info/RECORD,,
82
+ tinybird-0.0.1.dev124.dist-info/METADATA,sha256=0B_zlu-C3jSAtHgjGRjlFZks5aVHgZ1I0zlGhMa2BZE,1612
83
+ tinybird-0.0.1.dev124.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
84
+ tinybird-0.0.1.dev124.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
85
+ tinybird-0.0.1.dev124.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
86
+ tinybird-0.0.1.dev124.dist-info/RECORD,,