tinybird 0.0.1.dev155__py3-none-any.whl → 0.0.1.dev156__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/workspace.py +49 -5
- {tinybird-0.0.1.dev155.dist-info → tinybird-0.0.1.dev156.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev155.dist-info → tinybird-0.0.1.dev156.dist-info}/RECORD +7 -7
- {tinybird-0.0.1.dev155.dist-info → tinybird-0.0.1.dev156.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev155.dist-info → tinybird-0.0.1.dev156.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev155.dist-info → tinybird-0.0.1.dev156.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.dev156'
|
|
8
|
+
__revision__ = '888fa61'
|
tinybird/tb/modules/workspace.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# - If it makes sense and only when strictly necessary, you can create utility functions in this file.
|
|
4
4
|
# - But please, **do not** interleave utility functions and command definitions.
|
|
5
5
|
|
|
6
|
-
from typing import Optional
|
|
6
|
+
from typing import Any, Dict, List, Optional
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
9
|
from click import Context
|
|
@@ -21,8 +21,8 @@ from tinybird.tb.modules.common import (
|
|
|
21
21
|
get_organizations_by_user,
|
|
22
22
|
get_user_token,
|
|
23
23
|
is_valid_starterkit,
|
|
24
|
-
print_current_workspace,
|
|
25
24
|
switch_workspace,
|
|
25
|
+
try_update_config_with_remote,
|
|
26
26
|
)
|
|
27
27
|
from tinybird.tb.modules.config import CLIConfig
|
|
28
28
|
from tinybird.tb.modules.exceptions import CLIWorkspaceException
|
|
@@ -70,21 +70,65 @@ async def workspace_ls(ctx: Context) -> None:
|
|
|
70
70
|
|
|
71
71
|
@workspace.command(name="use")
|
|
72
72
|
@click.argument("workspace_name_or_id")
|
|
73
|
+
@click.pass_context
|
|
73
74
|
@coro
|
|
74
|
-
async def workspace_use(workspace_name_or_id: str) -> None:
|
|
75
|
+
async def workspace_use(ctx: Context, workspace_name_or_id: str) -> None:
|
|
75
76
|
"""Switch to another workspace. Use 'tb workspace ls' to list the workspaces you have access to."""
|
|
76
77
|
config = CLIConfig.get_project_config()
|
|
78
|
+
is_cloud = ctx.ensure_object(dict)["env"] == "cloud"
|
|
79
|
+
if not is_cloud:
|
|
80
|
+
raise CLIWorkspaceException(
|
|
81
|
+
FeedbackManager.error(
|
|
82
|
+
message="`tb workspace use` is not available in local mode. Use --cloud to switch to a cloud workspace and it will be used in Tinybird Local."
|
|
83
|
+
)
|
|
84
|
+
)
|
|
77
85
|
|
|
78
86
|
await switch_workspace(config, workspace_name_or_id)
|
|
79
87
|
|
|
80
88
|
|
|
81
89
|
@workspace.command(name="current")
|
|
90
|
+
@click.pass_context
|
|
82
91
|
@coro
|
|
83
|
-
async def workspace_current():
|
|
92
|
+
async def workspace_current(ctx: Context):
|
|
84
93
|
"""Show the workspace you're currently authenticated to"""
|
|
85
94
|
config = CLIConfig.get_project_config()
|
|
95
|
+
env = ctx.ensure_object(dict)["env"]
|
|
96
|
+
client: TinyB = ctx.ensure_object(dict)["client"]
|
|
97
|
+
if env == "cloud":
|
|
98
|
+
_ = await try_update_config_with_remote(config, only_if_needed=True)
|
|
99
|
+
|
|
100
|
+
user_workspaces = await client.user_workspaces(version="v1")
|
|
101
|
+
current_workspace = await client.workspace_info(version="v1")
|
|
102
|
+
|
|
103
|
+
def _get_current_workspace(user_workspaces: Dict[str, Any], current_workspace_id: str) -> Optional[Dict[str, Any]]:
|
|
104
|
+
def get_workspace_by_name(workspaces: List[Dict[str, Any]], name: str) -> Optional[Dict[str, Any]]:
|
|
105
|
+
return next((ws for ws in workspaces if ws["name"] == name), None)
|
|
106
|
+
|
|
107
|
+
workspaces: Optional[List[Dict[str, Any]]] = user_workspaces.get("workspaces")
|
|
108
|
+
if not workspaces:
|
|
109
|
+
return None
|
|
110
|
+
|
|
111
|
+
current: Optional[Dict[str, Any]] = get_workspace_by_name(workspaces, current_workspace_id)
|
|
112
|
+
return current
|
|
86
113
|
|
|
87
|
-
|
|
114
|
+
current_main_workspace = _get_current_workspace(user_workspaces, config.get("name", current_workspace["name"]))
|
|
115
|
+
|
|
116
|
+
assert isinstance(current_main_workspace, dict)
|
|
117
|
+
|
|
118
|
+
columns = ["name", "id", "role", "plan", "current"]
|
|
119
|
+
|
|
120
|
+
table = [
|
|
121
|
+
(
|
|
122
|
+
current_main_workspace["name"],
|
|
123
|
+
current_main_workspace["id"],
|
|
124
|
+
current_main_workspace["role"],
|
|
125
|
+
_get_workspace_plan_name(current_main_workspace["plan"]),
|
|
126
|
+
True,
|
|
127
|
+
)
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
click.echo(FeedbackManager.info_current_workspace())
|
|
131
|
+
echo_safe_humanfriendly_tables_format_smart_table(table, column_names=columns)
|
|
88
132
|
|
|
89
133
|
|
|
90
134
|
@workspace.command(name="create", short_help="Create a new Workspace for your Tinybird user")
|
|
@@ -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=BZuPM7MFS7vaEKK5tOMR2bwSAgJudPrJt27uVEwZmTY,40512
|
|
15
|
-
tinybird/tb/__cli__.py,sha256=
|
|
15
|
+
tinybird/tb/__cli__.py,sha256=9Uom43LFpjyePOXqbI6-l2C6x4WEikJFuS8e2W83184,247
|
|
16
16
|
tinybird/tb/check_pypi.py,sha256=rW4QmDRbtgKdUUwJCnBkVjmTjZSZGN-XgZhx7vMkC0w,1009
|
|
17
17
|
tinybird/tb/cli.py,sha256=uPV6pvi4aYVfaiGs0DQO-eoi1g9dHlrgvhutkXkdJko,1075
|
|
18
18
|
tinybird/tb/client.py,sha256=aaPKq5C77e72kR7IMv9WrvnvNki8mKMOTi9EsCp0eUc,55962
|
|
@@ -54,7 +54,7 @@ tinybird/tb/modules/telemetry.py,sha256=IHHks8-jnrkyQIY_Y6ZmU8hdVHMGSS0pkSUOgCPc
|
|
|
54
54
|
tinybird/tb/modules/test.py,sha256=Yopg89cRwOQpgRzsb9nvu2Z-UR2as2vBjVa5PF3uiK0,13420
|
|
55
55
|
tinybird/tb/modules/token.py,sha256=2fmKwu10_M0pqs6YmJVeILR9ZQB0ejRAET86agASbKM,13488
|
|
56
56
|
tinybird/tb/modules/watch.py,sha256=_92co0BjTikQuy7MbHr4TDu9A75QdHsrAO8v7DlYLg4,8898
|
|
57
|
-
tinybird/tb/modules/workspace.py,sha256=
|
|
57
|
+
tinybird/tb/modules/workspace.py,sha256=JIPfsh243gCiCkB3bw0Zx0VcivCeMq34xqlfuT3aURE,8518
|
|
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.dev156.dist-info/METADATA,sha256=aukxrlc7qfXhgKxSlMHSAOoWo15HAwKnXu2stIMf4bI,1607
|
|
84
|
+
tinybird-0.0.1.dev156.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
85
|
+
tinybird-0.0.1.dev156.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
86
|
+
tinybird-0.0.1.dev156.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
87
|
+
tinybird-0.0.1.dev156.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|