tinybird 0.0.1.dev38__tar.gz → 0.0.1.dev40__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 (102) hide show
  1. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/PKG-INFO +1 -1
  2. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/__cli__.py +2 -2
  3. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/build.py +37 -21
  4. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/mock.py +1 -1
  5. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/shell.py +4 -4
  6. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird.egg-info/PKG-INFO +1 -1
  7. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/setup.cfg +0 -0
  8. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/__cli__.py +0 -0
  9. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/ch_utils/constants.py +0 -0
  10. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/ch_utils/engine.py +0 -0
  11. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/check_pypi.py +0 -0
  12. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/client.py +0 -0
  13. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/config.py +0 -0
  14. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/connectors.py +0 -0
  15. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/context.py +0 -0
  16. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/datafile.py +0 -0
  17. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/datatypes.py +0 -0
  18. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/feedback_manager.py +0 -0
  19. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/git_settings.py +0 -0
  20. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/prompts.py +0 -0
  21. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/sql.py +0 -0
  22. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/sql_template.py +0 -0
  23. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/sql_template_fmt.py +0 -0
  24. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/sql_toolset.py +0 -0
  25. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/syncasync.py +0 -0
  26. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/cli.py +0 -0
  27. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/auth.py +0 -0
  28. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/build_client.py +0 -0
  29. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/cicd.py +0 -0
  30. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/cli.py +0 -0
  31. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/common.py +0 -0
  32. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/config.py +0 -0
  33. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/copy.py +0 -0
  34. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/create.py +0 -0
  35. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/build.py +0 -0
  36. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/build_common.py +0 -0
  37. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
  38. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
  39. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/common.py +0 -0
  40. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/diff.py +0 -0
  41. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/exceptions.py +0 -0
  42. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/fixture.py +0 -0
  43. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/format_common.py +0 -0
  44. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
  45. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
  46. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/parse_datasource.py +0 -0
  47. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/parse_pipe.py +0 -0
  48. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
  49. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datafile/pull.py +0 -0
  50. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/datasource.py +0 -0
  51. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/deployment.py +0 -0
  52. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/endpoint.py +0 -0
  53. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/exceptions.py +0 -0
  54. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/feedback_manager.py +0 -0
  55. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/fmt.py +0 -0
  56. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/job.py +0 -0
  57. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/llm.py +0 -0
  58. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/llm_utils.py +0 -0
  59. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/local.py +0 -0
  60. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/local_common.py +0 -0
  61. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/login.py +0 -0
  62. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/pipe.py +0 -0
  63. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/project.py +0 -0
  64. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/regions.py +0 -0
  65. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/table.py +0 -0
  66. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/tag.py +0 -0
  67. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/telemetry.py +0 -0
  68. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/test.py +0 -0
  69. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
  70. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
  71. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/token.py +0 -0
  72. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/update.py +0 -0
  73. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/watch.py +0 -0
  74. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/workspace.py +0 -0
  75. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb/modules/workspace_members.py +0 -0
  76. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli.py +0 -0
  77. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/auth.py +0 -0
  78. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/branch.py +0 -0
  79. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/cicd.py +0 -0
  80. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/cli.py +0 -0
  81. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/common.py +0 -0
  82. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/config.py +0 -0
  83. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/connection.py +0 -0
  84. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/datasource.py +0 -0
  85. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/exceptions.py +0 -0
  86. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/fmt.py +0 -0
  87. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/job.py +0 -0
  88. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/pipe.py +0 -0
  89. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/regions.py +0 -0
  90. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/tag.py +0 -0
  91. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/telemetry.py +0 -0
  92. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/test.py +0 -0
  93. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  94. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  95. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/workspace.py +0 -0
  96. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  97. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird/tornado_template.py +0 -0
  98. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird.egg-info/SOURCES.txt +0 -0
  99. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird.egg-info/dependency_links.txt +0 -0
  100. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird.egg-info/entry_points.txt +0 -0
  101. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird.egg-info/requires.txt +0 -0
  102. {tinybird-0.0.1.dev38 → tinybird-0.0.1.dev40}/tinybird.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird
3
- Version: 0.0.1.dev38
3
+ Version: 0.0.1.dev40
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.dev38'
8
- __revision__ = '3c8961f'
7
+ __version__ = '0.0.1.dev40'
8
+ __revision__ = '4f6c174'
@@ -16,7 +16,7 @@ from tinybird.tb.modules.datafile.fixture import build_fixture_name, get_fixture
16
16
  from tinybird.tb.modules.feedback_manager import FeedbackManager
17
17
  from tinybird.tb.modules.local_common import get_tinybird_local_client
18
18
  from tinybird.tb.modules.project import Project
19
- from tinybird.tb.modules.shell import Shell
19
+ from tinybird.tb.modules.shell import Shell, print_table_formatted
20
20
  from tinybird.tb.modules.watch import watch_project
21
21
 
22
22
 
@@ -36,20 +36,23 @@ def build(ctx: click.Context, watch: bool) -> None:
36
36
 
37
37
  def process(file_changed: Optional[str] = None) -> None:
38
38
  if file_changed and file_changed.endswith(".ndjson"):
39
- rebuild_fixture(project, tb_client, file_changed)
39
+ rebuild_fixture(project, file_changed)
40
40
  else:
41
41
  build_project(project, tb_client)
42
+ new_tb_client = asyncio.run(get_tinybird_local_client(str(project.path)))
43
+ try:
44
+ if file_changed:
45
+ build_and_print_resource(new_tb_client, file_changed)
46
+ except Exception:
47
+ pass
42
48
 
43
49
  process()
44
50
  time_end = time.time()
45
51
  elapsed_time = time_end - time_start
46
- if project.get_config()["user_email"] == "javi@tinybird.co":
47
- click.echo(FeedbackManager.success(message="\n✓ Build completed in 0.0000001s"))
48
- else:
49
- click.echo(FeedbackManager.success(message=f"\n✓ Build completed in {elapsed_time:.1f}s"))
52
+ click.echo(FeedbackManager.success(message=f"\n✓ Build completed in {elapsed_time:.1f}s"))
50
53
 
51
54
  if watch:
52
- shell = Shell(project=project, client=tb_client)
55
+ shell = Shell(project=project)
53
56
  click.echo(FeedbackManager.gray(message="\nWatching for changes..."))
54
57
  watcher_thread = threading.Thread(
55
58
  target=watch_project,
@@ -112,6 +115,7 @@ def build_project(project: Project, tb_client: TinyB) -> None:
112
115
  click.echo(FeedbackManager.info(message=f"✓ {pipe_path} created"))
113
116
 
114
117
  try:
118
+ new_tb_client = asyncio.run(get_tinybird_local_client(str(project.path)))
115
119
  for filename in project_files:
116
120
  if filename.endswith(".datasource"):
117
121
  ds_path = Path(filename)
@@ -124,7 +128,7 @@ def build_project(project: Project, tb_client: TinyB) -> None:
124
128
  fixture_path = fixture_folder / f"{ds_name}.ndjson"
125
129
 
126
130
  if fixture_path.exists():
127
- append_fixture(tb_client, ds_name, str(fixture_path))
131
+ append_fixture(new_tb_client, ds_name, str(fixture_path))
128
132
  except Exception:
129
133
  pass
130
134
 
@@ -150,7 +154,6 @@ def append_fixture(
150
154
  datasource_name: str,
151
155
  url: str,
152
156
  ):
153
- asyncio.run(tb_client.datasource_truncate(datasource_name))
154
157
  asyncio.run(
155
158
  push_data(
156
159
  tb_client,
@@ -163,18 +166,31 @@ def append_fixture(
163
166
  )
164
167
 
165
168
 
166
- def rebuild_fixture(project: Project, tb_client: TinyB, fixture: str) -> None:
167
- fixture_path = Path(fixture)
168
- datasources_path = Path(project.folder) / "datasources"
169
- ds_name = fixture_path.stem
169
+ def rebuild_fixture(project: Project, fixture: str) -> None:
170
+ try:
171
+ tb_client = asyncio.run(get_tinybird_local_client(str(project.path)))
172
+ fixture_path = Path(fixture)
173
+ datasources_path = Path(project.folder) / "datasources"
174
+ ds_name = fixture_path.stem
170
175
 
171
- if ds_name not in project.datasources:
172
- try:
173
- ds_name = "_".join(fixture_path.stem.split("_")[:-1])
174
- except Exception:
175
- pass
176
+ if ds_name not in project.datasources:
177
+ try:
178
+ ds_name = "_".join(fixture_path.stem.split("_")[:-1])
179
+ except Exception:
180
+ pass
181
+
182
+ ds_path = datasources_path / f"{ds_name}.datasource"
183
+
184
+ if ds_path.exists():
185
+ asyncio.run(tb_client.datasource_truncate(ds_name))
186
+ append_fixture(tb_client, ds_name, str(fixture_path))
187
+ except Exception as e:
188
+ click.echo(FeedbackManager.error_exception(error=e))
176
189
 
177
- ds_path = datasources_path / f"{ds_name}.datasource"
178
190
 
179
- if ds_path.exists():
180
- append_fixture(tb_client, ds_name, str(fixture_path))
191
+ def build_and_print_resource(tb_client: TinyB, filename: str):
192
+ resource_path = Path(filename)
193
+ name = resource_path.stem
194
+ pipeline = name if filename.endswith(".pipe") else None
195
+ res = asyncio.run(tb_client.query(f"SELECT * FROM {name} FORMAT JSON", pipeline=pipeline))
196
+ print_table_formatted(res, name)
@@ -47,7 +47,7 @@ async def mock(datasource: str, rows: int, prompt: str, folder: str) -> None:
47
47
  datasource_path = Path(folder) / datasource_path
48
48
 
49
49
  prompt_path = Path(folder) / "fixtures" / f"{datasource_name}.prompt"
50
- if not prompt:
50
+ if not prompt or prompt == "Use the datasource schema to generate sample data":
51
51
  # load the prompt from the fixture.prompt file if it exists
52
52
  if prompt_path.exists():
53
53
  prompt = prompt_path.read_text()
@@ -14,9 +14,9 @@ from prompt_toolkit.key_binding import KeyBindings
14
14
  from prompt_toolkit.shortcuts import CompleteStyle
15
15
  from prompt_toolkit.styles import Style
16
16
 
17
- from tinybird.client import TinyB
18
17
  from tinybird.tb.modules.exceptions import CLIException
19
18
  from tinybird.tb.modules.feedback_manager import FeedbackManager, bcolors
19
+ from tinybird.tb.modules.local_common import get_tinybird_local_client
20
20
  from tinybird.tb.modules.project import Project
21
21
  from tinybird.tb.modules.table import format_table
22
22
 
@@ -174,10 +174,9 @@ def _(event):
174
174
 
175
175
 
176
176
  class Shell:
177
- def __init__(self, project: Project, client: TinyB):
177
+ def __init__(self, project: Project):
178
178
  self.history = self.get_history()
179
179
  self.project = project
180
- self.client = client
181
180
  self.prompt_message = "\ntb > "
182
181
  self.commands = ["create", "mock", "test", "tb", "select"]
183
182
  self.session: PromptSession = PromptSession(
@@ -286,8 +285,9 @@ class Shell:
286
285
  loop = asyncio.new_event_loop()
287
286
  asyncio.set_event_loop(loop)
288
287
  try:
288
+ tb_client = asyncio.run(get_tinybird_local_client(str(self.project.path)))
289
289
  return loop.run_until_complete(
290
- self.client.query(f"SELECT * FROM ({query}) LIMIT {rows_limit} FORMAT JSON")
290
+ tb_client.query(f"SELECT * FROM ({query}) LIMIT {rows_limit} FORMAT JSON")
291
291
  )
292
292
  finally:
293
293
  loop.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tinybird
3
- Version: 0.0.1.dev38
3
+ Version: 0.0.1.dev40
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