tinybird 0.0.1.dev184__py3-none-any.whl → 0.0.1.dev186__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 +2 -2
- tinybird/tb/modules/common.py +12 -3
- tinybird/tb/modules/create.py +9 -11
- tinybird/tb/modules/workspace.py +14 -3
- {tinybird-0.0.1.dev184.dist-info → tinybird-0.0.1.dev186.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev184.dist-info → tinybird-0.0.1.dev186.dist-info}/RECORD +9 -9
- {tinybird-0.0.1.dev184.dist-info → tinybird-0.0.1.dev186.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev184.dist-info → tinybird-0.0.1.dev186.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev184.dist-info → tinybird-0.0.1.dev186.dist-info}/top_level.txt +0 -0
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.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev186'
|
|
8
|
+
__revision__ = '57239e4'
|
tinybird/tb/modules/common.py
CHANGED
|
@@ -174,8 +174,12 @@ def generate_datafile(
|
|
|
174
174
|
base = Path(folder) / base
|
|
175
175
|
datasource_name = normalize_datasource_name(p.stem)
|
|
176
176
|
if not base.exists():
|
|
177
|
-
|
|
177
|
+
if folder:
|
|
178
|
+
base = Path(folder)
|
|
179
|
+
else:
|
|
180
|
+
base = Path()
|
|
178
181
|
f = base / (datasource_name + ".datasource")
|
|
182
|
+
|
|
179
183
|
if not f.exists() or force:
|
|
180
184
|
with open(f"{f}", "w") as ds_file:
|
|
181
185
|
ds_file.write(datafile)
|
|
@@ -421,13 +425,18 @@ async def _analyze(filename: str, client: TinyB, format: str, connector: Optiona
|
|
|
421
425
|
|
|
422
426
|
|
|
423
427
|
async def _generate_datafile(
|
|
424
|
-
filename: str,
|
|
428
|
+
filename: str,
|
|
429
|
+
client: TinyB,
|
|
430
|
+
format: str,
|
|
431
|
+
connector: Optional["Connector"] = None,
|
|
432
|
+
force: Optional[bool] = False,
|
|
433
|
+
folder: Optional[str] = None,
|
|
425
434
|
):
|
|
426
435
|
meta, data = await _analyze(filename, client, format, connector=connector)
|
|
427
436
|
schema = meta["analysis"]["schema"]
|
|
428
437
|
schema = schema.replace(", ", ",\n ")
|
|
429
438
|
datafile = f"""DESCRIPTION >\n Generated from {filename}\n\nSCHEMA >\n {schema}"""
|
|
430
|
-
return generate_datafile(datafile, filename, data, force, _format=format)
|
|
439
|
+
return generate_datafile(datafile, filename, data, force, _format=format, folder=folder)
|
|
431
440
|
|
|
432
441
|
|
|
433
442
|
async def configure_connector(connector):
|
tinybird/tb/modules/create.py
CHANGED
|
@@ -56,9 +56,6 @@ async def create(
|
|
|
56
56
|
config.persist_to_file()
|
|
57
57
|
project.folder = folder
|
|
58
58
|
|
|
59
|
-
if cwd := config.get("cwd"):
|
|
60
|
-
click.echo(FeedbackManager.gray(message=f"Using '{cwd.replace(os.getcwd(), '')}' as target folder"))
|
|
61
|
-
|
|
62
59
|
root_folder = os.getcwd()
|
|
63
60
|
if config._path:
|
|
64
61
|
root_folder = os.path.dirname(config._path)
|
|
@@ -78,7 +75,7 @@ async def create(
|
|
|
78
75
|
if not user_token:
|
|
79
76
|
raise Exception("This action requires authentication. Run 'tb login' first.")
|
|
80
77
|
|
|
81
|
-
if not validate_project_structure(
|
|
78
|
+
if not validate_project_structure(project):
|
|
82
79
|
click.echo(FeedbackManager.highlight(message="\n» Creating new project structure..."))
|
|
83
80
|
create_project_structure(folder)
|
|
84
81
|
click.echo(FeedbackManager.success(message="✓ Scaffolding completed!\n"))
|
|
@@ -188,14 +185,13 @@ async def create(
|
|
|
188
185
|
PROJECT_PATHS = ("datasources", "endpoints", "materializations", "copies", "pipes", "fixtures", "tests", "connections")
|
|
189
186
|
|
|
190
187
|
|
|
191
|
-
def validate_project_structure(
|
|
192
|
-
some_folder_created = any((Path(folder) / path).exists() for path in PROJECT_PATHS)
|
|
188
|
+
def validate_project_structure(project: Project) -> bool:
|
|
189
|
+
some_folder_created = any((Path(project.folder) / path).exists() for path in PROJECT_PATHS)
|
|
193
190
|
if some_folder_created:
|
|
194
191
|
return True
|
|
195
192
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
pipes = list(folder_path.glob("**/*.pipe"))
|
|
193
|
+
datasources = project.get_datasource_files()
|
|
194
|
+
pipes = project.get_pipe_files()
|
|
199
195
|
|
|
200
196
|
return len(datasources) > 0 or len(pipes) > 0
|
|
201
197
|
|
|
@@ -468,9 +464,11 @@ async def create_resources_from_data(
|
|
|
468
464
|
local_client = await get_tinybird_local_client(config)
|
|
469
465
|
folder_path = project.path
|
|
470
466
|
path = folder_path / data
|
|
467
|
+
if not path.exists():
|
|
468
|
+
path = Path(data)
|
|
471
469
|
result: List[Path] = []
|
|
472
470
|
format = path.suffix.lstrip(".")
|
|
473
|
-
ds_file = await _generate_datafile(str(path), local_client, format=format, force=True)
|
|
471
|
+
ds_file = await _generate_datafile(str(path), local_client, format=format, force=True, folder=project.folder)
|
|
474
472
|
result.append(ds_file)
|
|
475
473
|
name = ds_file.stem
|
|
476
474
|
no_pipes = len(project.get_pipe_files()) == 0
|
|
@@ -493,7 +491,7 @@ async def create_resources_from_url(url: str, project: Project, config: Dict[str
|
|
|
493
491
|
result: List[Path] = []
|
|
494
492
|
local_client = await get_tinybird_local_client(config)
|
|
495
493
|
format = url.split(".")[-1]
|
|
496
|
-
ds_file = await _generate_datafile(url, local_client, format=format, force=True)
|
|
494
|
+
ds_file = await _generate_datafile(url, local_client, format=format, force=True, folder=project.folder)
|
|
497
495
|
result.append(ds_file)
|
|
498
496
|
name = ds_file.stem
|
|
499
497
|
no_pipes = len(project.get_pipe_files()) == 0
|
tinybird/tb/modules/workspace.py
CHANGED
|
@@ -138,7 +138,6 @@ async def workspace_current(ctx: Context):
|
|
|
138
138
|
|
|
139
139
|
@workspace.command(name="create", short_help="Create a new Workspace for your Tinybird user")
|
|
140
140
|
@click.argument("workspace_name", required=False)
|
|
141
|
-
@click.option("--user_token", is_flag=False, default=None, help="When passed, tb won't prompt asking for the token")
|
|
142
141
|
@click.option(
|
|
143
142
|
"--fork",
|
|
144
143
|
is_flag=True,
|
|
@@ -157,13 +156,25 @@ async def workspace_current(ctx: Context):
|
|
|
157
156
|
async def create_workspace(
|
|
158
157
|
ctx: Context,
|
|
159
158
|
workspace_name: str,
|
|
160
|
-
user_token: Optional[str],
|
|
161
159
|
fork: bool,
|
|
162
160
|
organization_id: Optional[str],
|
|
163
161
|
) -> None:
|
|
164
162
|
config = CLIConfig.get_project_config()
|
|
163
|
+
is_cloud = ctx.ensure_object(dict)["env"] == "cloud"
|
|
164
|
+
if not is_cloud:
|
|
165
|
+
raise CLIWorkspaceException(
|
|
166
|
+
FeedbackManager.error(
|
|
167
|
+
message="`tb workspace create` is not available in local mode. Use --cloud to create a workspace in Tinybird Cloud and it will be used in Tinybird Local."
|
|
168
|
+
)
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
config = CLIConfig.get_project_config()
|
|
172
|
+
user_token = config.get_user_token()
|
|
165
173
|
|
|
166
|
-
|
|
174
|
+
if not user_token:
|
|
175
|
+
raise CLIWorkspaceException(
|
|
176
|
+
FeedbackManager.error(message="This action requires authentication. Run 'tb login' first.")
|
|
177
|
+
)
|
|
167
178
|
|
|
168
179
|
organization_name = None
|
|
169
180
|
organizations = await get_organizations_by_user(config, user_token)
|
|
@@ -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=
|
|
15
|
+
tinybird/tb/__cli__.py,sha256=fgDoHWj5-L_sJYYjP6ocah4vsol2C_odPl9VN2POpgU,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
|
|
@@ -20,11 +20,11 @@ tinybird/tb/config.py,sha256=jT9xndpeCY_g0HdB5qE2EquC0TFRRnkPnQFWZWd04jo,3998
|
|
|
20
20
|
tinybird/tb/modules/build.py,sha256=rRL5XKBdadMc9uVDEUt0GXm0h09Y6XXw199rdmRI1qo,19127
|
|
21
21
|
tinybird/tb/modules/cicd.py,sha256=MnShTTJzKBYeajswF2jg7p7ZzupaeCgSriAN05MeEdg,7330
|
|
22
22
|
tinybird/tb/modules/cli.py,sha256=dXZs-MuqYPvxStVj7aLg36LwXtEB8NzTobDmHV9nzZI,15508
|
|
23
|
-
tinybird/tb/modules/common.py,sha256=
|
|
23
|
+
tinybird/tb/modules/common.py,sha256=DYCjpj0iBaCDZ8BJ0MNG_6m6NyFMCrpQShIajHKLIfM,83373
|
|
24
24
|
tinybird/tb/modules/config.py,sha256=ziqW_t_mRVvWOd85VoB4vKyvgMkEfpXDf9H4v38p2xc,11422
|
|
25
25
|
tinybird/tb/modules/connection.py,sha256=7oOR7x4PhBcm1ETFFCH2YJ_3oeGXjAbmx1cnZX9_L70,9014
|
|
26
26
|
tinybird/tb/modules/copy.py,sha256=2Mm4FWKehOG7CoOhiF1m9UZJgJn0W1_cMolqju8ONYg,5805
|
|
27
|
-
tinybird/tb/modules/create.py,sha256=
|
|
27
|
+
tinybird/tb/modules/create.py,sha256=3ccvOCcuJfhhaaoX60-6dSmnF8SfnOLTfVqLJs48jOA,18672
|
|
28
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
|
|
@@ -54,7 +54,7 @@ tinybird/tb/modules/telemetry.py,sha256=X0p5AVkM8BNsK_Rhdcg4p2eIf6OHimHO_VLldBqH
|
|
|
54
54
|
tinybird/tb/modules/test.py,sha256=QxyDkHGL9Ae46h7BA00z1Efb2_5dBYGqW8cgKIJer5s,13081
|
|
55
55
|
tinybird/tb/modules/token.py,sha256=2fmKwu10_M0pqs6YmJVeILR9ZQB0ejRAET86agASbKM,13488
|
|
56
56
|
tinybird/tb/modules/watch.py,sha256=H1FieLTVGRqmZ0hR0vELbQJ9l0CThrFCgGCta-MPuAY,8883
|
|
57
|
-
tinybird/tb/modules/workspace.py,sha256
|
|
57
|
+
tinybird/tb/modules/workspace.py,sha256=WDi3Vu9t60b4Ht5vbPsakUErFmsECtFRcfXb1l300xc,11057
|
|
58
58
|
tinybird/tb/modules/workspace_members.py,sha256=RYLpyPM1ECCasHRg3uvpckzXplX0_KgNFsSPZn_i6qk,8744
|
|
59
59
|
tinybird/tb/modules/datafile/build.py,sha256=d_h3pRFDPFrDKGhpFx2iejY25GuB2k8yfNouj6s8caw,50973
|
|
60
60
|
tinybird/tb/modules/datafile/build_common.py,sha256=LU24kAQmxDJIyoIapDaYG-SU3P4FrMG9UBf8m9PgVSI,4565
|
|
@@ -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.
|
|
84
|
-
tinybird-0.0.1.
|
|
85
|
-
tinybird-0.0.1.
|
|
86
|
-
tinybird-0.0.1.
|
|
87
|
-
tinybird-0.0.1.
|
|
83
|
+
tinybird-0.0.1.dev186.dist-info/METADATA,sha256=XBsl7gXGbcV3mEUvFluqVdyPzg8F-X-c6kXWzx1Cbr4,1608
|
|
84
|
+
tinybird-0.0.1.dev186.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
85
|
+
tinybird-0.0.1.dev186.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
86
|
+
tinybird-0.0.1.dev186.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
87
|
+
tinybird-0.0.1.dev186.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|