tinybird 0.0.1.dev182__py3-none-any.whl → 0.0.1.dev183__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/forward/commands'
5
5
  __author__ = 'Tinybird'
6
6
  __author_email__ = 'support@tinybird.co'
7
- __version__ = '0.0.1.dev182'
8
- __revision__ = 'b1eeede'
7
+ __version__ = '0.0.1.dev183'
8
+ __revision__ = '1e2d149'
@@ -1,5 +1,5 @@
1
1
  from pathlib import Path
2
- from typing import Any, Dict, List, Union
2
+ from typing import Any, Dict, List, Optional, Union
3
3
 
4
4
  from tinybird.tb.modules.common import format_data_to_ndjson
5
5
 
@@ -17,10 +17,16 @@ def persist_fixture_sql(fixture_name: str, sql: str, folder: str) -> Path:
17
17
  return fixture_file
18
18
 
19
19
 
20
- def persist_fixture(fixture_name: str, data: Union[List[Dict[str, Any]], str], folder: str, format: str) -> Path:
21
- fixture_dir = get_fixture_dir(folder)
22
- fixture_file = fixture_dir / f"{fixture_name}.{format}"
23
- extension = f".{format}"
20
+ def persist_fixture(
21
+ fixture_name: str, data: Union[List[Dict[str, Any]], str], folder: str, format: str, target: Optional[str] = None
22
+ ) -> Path:
23
+ if target:
24
+ fixture_file = Path(target)
25
+ extension = fixture_file.suffix
26
+ else:
27
+ fixture_dir = get_fixture_dir(folder)
28
+ fixture_file = fixture_dir / f"{fixture_name}.{format}"
29
+ extension = f".{format}"
24
30
  if extension == FixtureExtension.NDJSON:
25
31
  fixture_file.write_text(data if isinstance(data, str) else format_data_to_ndjson(data))
26
32
  elif extension == FixtureExtension.CSV:
@@ -423,19 +423,15 @@ async def datasource_export(
423
423
  Example usage:
424
424
  - Export all rows as CSV: tb datasource export my_datasource
425
425
  - Export 1000 rows as NDJSON: tb datasource export my_datasource --format ndjson --rows 1000
426
- - Export to specific file: tb datasource export my_datasource --output ./data/export.csv
426
+ - Export to specific file: tb datasource export my_datasource --target ./data/export.csv
427
427
  """
428
428
  client: TinyB = ctx.ensure_object(dict)["client"]
429
429
  project: Project = ctx.ensure_object(dict)["project"]
430
430
 
431
- # Determine output filename if not provided
432
- if not target:
433
- target = f"{datasource}.{format_}"
434
-
435
431
  # Build query with optional row limit
436
432
  query = f"SELECT * FROM {datasource} WHERE {where or 1} LIMIT {rows}"
437
433
 
438
- click.echo(FeedbackManager.highlight(message=f"\n» Exporting {datasource} to {target}"))
434
+ click.echo(FeedbackManager.highlight(message=f"\n» Exporting {datasource}"))
439
435
 
440
436
  try:
441
437
  if format_ == "csv":
@@ -445,11 +441,13 @@ async def datasource_export(
445
441
 
446
442
  res = await client.query(query)
447
443
 
448
- fixture_path = persist_fixture(datasource, res, project.folder, format=format_)
449
- file_size = os.path.getsize(fixture_path)
444
+ target_path = persist_fixture(datasource, res, project.folder, format=format_, target=target)
445
+ file_size = os.path.getsize(target_path)
450
446
 
451
447
  click.echo(
452
- FeedbackManager.success(message=f"✓ Exported data to {target} ({humanfriendly.format_size(file_size)})")
448
+ FeedbackManager.success(
449
+ message=f"✓ Exported data to {str(target_path).replace(project.folder, '')} ({humanfriendly.format_size(file_size)})"
450
+ )
453
451
  )
454
452
 
455
453
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev182
3
+ Version: 0.0.1.dev183
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -12,7 +12,7 @@ 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=X4tE9OrfaUy6kO9cqVEzyI9cDcmOF3IAssRRzsTsfEQ,40781
15
- tinybird/tb/__cli__.py,sha256=Hcpk55aD10v-3_hprG0jGUy2hJWHo_jTD4ohLxO7jIs,247
15
+ tinybird/tb/__cli__.py,sha256=I3YL2OnI6jdHeZZqhxx8ydlJp5zrUKANN9Bqmzf28WY,247
16
16
  tinybird/tb/check_pypi.py,sha256=rW4QmDRbtgKdUUwJCnBkVjmTjZSZGN-XgZhx7vMkC0w,1009
17
17
  tinybird/tb/cli.py,sha256=u3eGOhX0MHkuT6tiwaZ0_3twqLmqKXDAOxF7yV_Nn9Q,1075
18
18
  tinybird/tb/client.py,sha256=59GH0IoYSV_KUG0eEbDDYHSWH4OlkVnSRFXE3mYAM0s,56571
@@ -25,7 +25,7 @@ tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc
25
25
  tinybird/tb/modules/connection.py,sha256=7oOR7x4PhBcm1ETFFCH2YJ_3oeGXjAbmx1cnZX9_L70,9014
26
26
  tinybird/tb/modules/copy.py,sha256=2Mm4FWKehOG7CoOhiF1m9UZJgJn0W1_cMolqju8ONYg,5805
27
27
  tinybird/tb/modules/create.py,sha256=jz5jswVntvsnNN-IbCXoKw9pUKySx_IubpP0rxi7Iy0,17528
28
- tinybird/tb/modules/datasource.py,sha256=mZ9N9LxbNA9QoKSMbxcMiQkdaQkfFqLeFB9_88e3_68,17843
28
+ tinybird/tb/modules/datasource.py,sha256=0_6Cn07p5GoNBBGdu88pSeLvTWojln1-k23FsS8jTDs,17801
29
29
  tinybird/tb/modules/deployment.py,sha256=t6DDLJ1YdY3SJiTPbEG7CRblSLkbuqwzauQ9y65FWtY,27147
30
30
  tinybird/tb/modules/deprecations.py,sha256=rrszC1f_JJeJ8mUxGoCxckQTJFBCR8wREf4XXXN-PRc,4507
31
31
  tinybird/tb/modules/dev_server.py,sha256=57FCKuWpErwYUYgHspYDkLWEm9F4pbvVOtMrFXX1fVU,10129
@@ -63,7 +63,7 @@ tinybird/tb/modules/datafile/build_pipe.py,sha256=6Cwjf3BKEF3-oQ9PipsQfK-Z43nSwt
63
63
  tinybird/tb/modules/datafile/common.py,sha256=9mZqagXTjw6XXdNBvTWv_jQDaLIwNBmKAd6VxhxRuVo,91721
64
64
  tinybird/tb/modules/datafile/diff.py,sha256=MTmj53RYjER4neLgWVjabn-FKVFgh8h8uYiBo55lFQg,6757
65
65
  tinybird/tb/modules/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1wnI,556
66
- tinybird/tb/modules/datafile/fixture.py,sha256=DrRWivcvo_1rn7LlVUnHcXccdgx9yVj63mzBkUwCzk8,1420
66
+ tinybird/tb/modules/datafile/fixture.py,sha256=gftYWeweeQDFK3cHgUmSOfltNjZVOuMt8v7WTMLhGBw,1579
67
67
  tinybird/tb/modules/datafile/format_common.py,sha256=1V1ZQuphp8EH2hT-IfZQEgz_0b9QqY177nwX8aMUte4,1962
68
68
  tinybird/tb/modules/datafile/format_datasource.py,sha256=iWbeXruxC7OBmjNgurWt6ymcJlYzxfKwkGnhpcoSKEo,6190
69
69
  tinybird/tb/modules/datafile/format_pipe.py,sha256=DUGdmlzI146YDqTwW-7kSIOXocz4AH-md_LFGUm9hrc,7436
@@ -80,8 +80,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
80
80
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
81
81
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
82
82
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
83
- tinybird-0.0.1.dev182.dist-info/METADATA,sha256=CcRyE9gi46a71FVojswEwM9vjvsZsMN8hqOcS5DuSh8,1608
84
- tinybird-0.0.1.dev182.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
- tinybird-0.0.1.dev182.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
- tinybird-0.0.1.dev182.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
- tinybird-0.0.1.dev182.dist-info/RECORD,,
83
+ tinybird-0.0.1.dev183.dist-info/METADATA,sha256=PHYeXR2ipg3vhMXXloKq0_uhArBd_xQyvQ9Wg_O64QE,1608
84
+ tinybird-0.0.1.dev183.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
85
+ tinybird-0.0.1.dev183.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
86
+ tinybird-0.0.1.dev183.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
87
+ tinybird-0.0.1.dev183.dist-info/RECORD,,