tinybird 0.0.1.dev73__tar.gz → 0.0.1.dev74__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.

Potentially problematic release.


This version of tinybird might be problematic. Click here for more details.

Files changed (103) hide show
  1. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/PKG-INFO +1 -1
  2. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/__cli__.py +2 -2
  3. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/build.py +13 -0
  4. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/common.py +17 -0
  5. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/deployment.py +24 -41
  6. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/project.py +5 -0
  7. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird.egg-info/PKG-INFO +1 -1
  8. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/setup.cfg +0 -0
  9. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/__cli__.py +0 -0
  10. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/ch_utils/constants.py +0 -0
  11. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/ch_utils/engine.py +0 -0
  12. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/check_pypi.py +0 -0
  13. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/client.py +0 -0
  14. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/config.py +0 -0
  15. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/connectors.py +0 -0
  16. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/context.py +0 -0
  17. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/datafile.py +0 -0
  18. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/datatypes.py +0 -0
  19. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/feedback_manager.py +0 -0
  20. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/git_settings.py +0 -0
  21. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/prompts.py +0 -0
  22. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/sql.py +0 -0
  23. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/sql_template.py +0 -0
  24. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/sql_template_fmt.py +0 -0
  25. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/sql_toolset.py +0 -0
  26. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/syncasync.py +0 -0
  27. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/cli.py +0 -0
  28. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/auth.py +0 -0
  29. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/cicd.py +0 -0
  30. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/cli.py +0 -0
  31. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/common.py +0 -0
  32. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/config.py +0 -0
  33. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/copy.py +0 -0
  34. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/create.py +0 -0
  35. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/build.py +0 -0
  36. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/build_common.py +0 -0
  37. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
  38. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
  39. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/diff.py +0 -0
  40. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/exceptions.py +0 -0
  41. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/fixture.py +0 -0
  42. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/format_common.py +0 -0
  43. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
  44. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
  45. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/parse_datasource.py +0 -0
  46. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/parse_pipe.py +0 -0
  47. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
  48. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/playground.py +0 -0
  49. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datafile/pull.py +0 -0
  50. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/datasource.py +0 -0
  51. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/endpoint.py +0 -0
  52. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/exceptions.py +0 -0
  53. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/feedback_manager.py +0 -0
  54. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/fmt.py +0 -0
  55. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/job.py +0 -0
  56. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/llm.py +0 -0
  57. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/llm_utils.py +0 -0
  58. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/local.py +0 -0
  59. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/local_common.py +0 -0
  60. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/login.py +0 -0
  61. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/materialization.py +0 -0
  62. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/mock.py +0 -0
  63. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/pipe.py +0 -0
  64. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/playground.py +0 -0
  65. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/regions.py +0 -0
  66. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/shell.py +0 -0
  67. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/table.py +0 -0
  68. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/tag.py +0 -0
  69. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/telemetry.py +0 -0
  70. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/test.py +0 -0
  71. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
  72. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
  73. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/token.py +0 -0
  74. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/watch.py +0 -0
  75. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/workspace.py +0 -0
  76. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb/modules/workspace_members.py +0 -0
  77. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli.py +0 -0
  78. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/auth.py +0 -0
  79. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/branch.py +0 -0
  80. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/cicd.py +0 -0
  81. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/cli.py +0 -0
  82. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/common.py +0 -0
  83. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/config.py +0 -0
  84. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/connection.py +0 -0
  85. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/datasource.py +0 -0
  86. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/exceptions.py +0 -0
  87. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/fmt.py +0 -0
  88. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/job.py +0 -0
  89. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/pipe.py +0 -0
  90. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/regions.py +0 -0
  91. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/tag.py +0 -0
  92. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/telemetry.py +0 -0
  93. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/test.py +0 -0
  94. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  95. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  96. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/workspace.py +0 -0
  97. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  98. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird/tornado_template.py +0 -0
  99. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird.egg-info/SOURCES.txt +0 -0
  100. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird.egg-info/dependency_links.txt +0 -0
  101. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird.egg-info/entry_points.txt +0 -0
  102. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird.egg-info/requires.txt +0 -0
  103. {tinybird-0.0.1.dev73 → tinybird-0.0.1.dev74}/tinybird.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev73
3
+ Version: 0.0.1.dev74
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
@@ -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.dev73'
8
- __revision__ = 'a843588'
7
+ __version__ = '0.0.1.dev74'
8
+ __revision__ = '68ada75'
@@ -7,6 +7,7 @@ import time
7
7
  from functools import partial
8
8
  from pathlib import Path
9
9
  from typing import Callable, Optional
10
+ from urllib.parse import urlencode
10
11
 
11
12
  import click
12
13
  import requests
@@ -191,6 +192,7 @@ def show_data(tb_client: TinyB, filename: str, diff: Optional[str] = None):
191
192
  table_name = diff
192
193
  resource_path = Path(filename)
193
194
  resource_name = resource_path.stem
195
+ resource_content = resource_path.read_text()
194
196
 
195
197
  pipeline = resource_name if filename.endswith(".pipe") else None
196
198
 
@@ -201,6 +203,17 @@ def show_data(tb_client: TinyB, filename: str, diff: Optional[str] = None):
201
203
 
202
204
  res = asyncio.run(tb_client.query(sql, pipeline=pipeline))
203
205
  print_table_formatted(res, table_name)
206
+ if Project.is_endpoint(resource_content):
207
+ example_params = {
208
+ "format": "json",
209
+ "pipe": resource_name,
210
+ "q": "",
211
+ "token": tb_client.token,
212
+ }
213
+ endpoint_url = asyncio.run(tb_client._req(f"/examples/query.http?{urlencode(example_params)}"))
214
+ if endpoint_url:
215
+ endpoint_url = endpoint_url.replace("http://localhost:8001", tb_client.host)
216
+ click.echo(FeedbackManager.gray(message="\nTest endpoint at ") + FeedbackManager.info(message=endpoint_url))
204
217
 
205
218
 
206
219
  def process(
@@ -1151,6 +1151,21 @@ def parse(
1151
1151
 
1152
1152
  return raise_deprecation_error
1153
1153
 
1154
+ def not_supported_yet(extra_message: str = "") -> Callable[..., Any]:
1155
+ def inner(func: Callable[..., Any]) -> Callable[..., Any]:
1156
+ @functools.wraps(func)
1157
+ def raise_not_supported_yet_error(*args: Any, **kwargs: Any) -> Any:
1158
+ extra_message_bit = f". {extra_message}" if extra_message else ""
1159
+ raise DatafileSyntaxError(
1160
+ f"{kwargs['cmd']} is not supported yet{extra_message_bit}",
1161
+ lineno=kwargs["lineno"],
1162
+ pos=1,
1163
+ )
1164
+
1165
+ return raise_not_supported_yet_error
1166
+
1167
+ return inner
1168
+
1154
1169
  def assign(attr):
1155
1170
  @multiline_not_supported
1156
1171
  def _fn(x, **kwargs):
@@ -1255,6 +1270,7 @@ def parse(
1255
1270
 
1256
1271
  return _f
1257
1272
 
1273
+ @not_supported_yet(extra_message="You can manage tokens with `tb token` in the meantime.")
1258
1274
  @multiline_not_supported
1259
1275
  def add_token(*args: str, **kwargs: Any) -> None: # token_name, permissions):
1260
1276
  # lineno = kwargs["lineno"]
@@ -1268,6 +1284,7 @@ def parse(
1268
1284
  # APPEND for datasources
1269
1285
  doc.tokens.append({"token_name": _unquote(args[0]), "permissions": args[1]})
1270
1286
 
1287
+ @not_supported_yet()
1271
1288
  def include(*args: str, **kwargs: Any) -> None:
1272
1289
  f = _unquote(args[0])
1273
1290
  f = eval_var(f)
@@ -339,36 +339,34 @@ def create_deployment(
339
339
  result = r.json()
340
340
  logging.debug(json.dumps(result, indent=2))
341
341
 
342
- if check:
343
- print_changes(result, project)
344
- feedback = result.get("deployment", {}).get("feedback", [])
345
- for f in feedback:
342
+ print_changes(result, project)
343
+
344
+ feedback = result.get("deployment", {}).get("feedback", [])
345
+ for f in feedback:
346
+ click.echo(FeedbackManager.warning(message=f"△ {f.get('level')}: {f.get('resource')}: {f.get('message')}"))
347
+
348
+ deploy_errors = result.get("deployment", {}).get("errors")
349
+ for deploy_error in deploy_errors:
350
+ if deploy_error.get("filename", None):
346
351
  click.echo(
347
- FeedbackManager.warning(message=f"{f.get('level')}: {f.get('resource')}: {f.get('message')}")
352
+ FeedbackManager.error(message=f"{deploy_error.get('filename')}\n\n{deploy_error.get('error')}")
348
353
  )
354
+ else:
355
+ click.echo(FeedbackManager.error(message=f"{deploy_error.get('error')}"))
349
356
 
350
- status = result.get("result")
357
+ status = result.get("result")
358
+ if check:
351
359
  if status == "success":
352
360
  click.echo(FeedbackManager.success(message="\n✓ Deployment is valid"))
353
- else:
354
- click.echo(FeedbackManager.error(message="\n✗ Deployment is not valid"))
355
- deploy_errors = result.get("errors")
356
- for deploy_error in deploy_errors:
357
- if deploy_error.get("filename", None):
358
- click.echo(
359
- FeedbackManager.error(
360
- message=f"{deploy_error.get('filename')}\n\n{deploy_error.get('error')}"
361
- )
362
- )
363
- else:
364
- click.echo(FeedbackManager.error(message=f"{deploy_error.get('error')}"))
365
- return
366
-
367
- deploy_result = result.get("result")
368
- if deploy_result == "success":
369
- print_changes(result, project)
361
+ sys.exit(0)
362
+
363
+ click.echo(FeedbackManager.error(message="\n✗ Deployment is not valid"))
364
+ sys.exit(1)
365
+
366
+ status = result.get("result")
367
+ if status == "success":
370
368
  deployment = result.get("deployment", {})
371
- # We show the url in the case of region is public
369
+ # TODO: This is a hack to show the url in the case of region is public. The URL should be returned by the API
372
370
  if client.host == "https://api.europe-west2.gcp.tinybird.co":
373
371
  click.echo(
374
372
  FeedbackManager.gray(message="Deployment URL: ")
@@ -381,25 +379,10 @@ def create_deployment(
381
379
  click.echo(FeedbackManager.info(message="\n✓ Deployment submitted successfully"))
382
380
  else:
383
381
  click.echo(FeedbackManager.success(message="\n✓ Deployment submitted successfully"))
384
-
385
- feedback = deployment.get("feedback", [])
386
- for f in feedback:
387
- click.echo(
388
- FeedbackManager.warning(message=f"△ {f.get('level')}: {f.get('resource')}: {f.get('message')}")
389
- )
390
-
391
- elif deploy_result == "failed":
382
+ elif status == "failed":
392
383
  click.echo(FeedbackManager.error(message="Deployment failed"))
393
- deploy_errors = result.get("errors")
394
- for deploy_error in deploy_errors:
395
- if deploy_error.get("filename", None):
396
- click.echo(
397
- FeedbackManager.error(message=f"{deploy_error.get('filename')}\n\n{deploy_error.get('error')}")
398
- )
399
- else:
400
- click.echo(FeedbackManager.error(message=f"{deploy_error.get('error')}"))
401
384
  else:
402
- click.echo(FeedbackManager.error(message=f"Unknown build result {deploy_result}"))
385
+ click.echo(FeedbackManager.error(message=f"Unknown build result {status}"))
403
386
  except Exception as e:
404
387
  click.echo(FeedbackManager.error_exception(error=e))
405
388
  finally:
@@ -1,5 +1,6 @@
1
1
  import glob
2
2
  import os
3
+ import re
3
4
  from pathlib import Path
4
5
  from typing import Dict, List, Optional
5
6
 
@@ -78,3 +79,7 @@ class Project:
78
79
  if datafile := self.get_datafile(filename):
79
80
  datafiles[filename] = datafile
80
81
  return datafiles
82
+
83
+ @staticmethod
84
+ def is_endpoint(content: str) -> bool:
85
+ return re.search(r"TYPE endpoint", content, re.IGNORECASE) is not None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev73
3
+ Version: 0.0.1.dev74
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/cli/introduction.html
6
6
  Author: Tinybird
File without changes