Skip to content

Commit d74d79d

Browse files
committed
Organizing imports in the quicksight module.
1 parent 7c4880d commit d74d79d

File tree

11 files changed

+865
-835
lines changed

11 files changed

+865
-835
lines changed

awswrangler/quicksight/__init__.py

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,43 @@
11
"""Amazon QuickSight Module."""
22

3-
from awswrangler.quicksight._cancel import * # noqa
4-
from awswrangler.quicksight._create import * # noqa
5-
from awswrangler.quicksight._delete import * # noqa
6-
from awswrangler.quicksight._describe import * # noqa
7-
from awswrangler.quicksight._get import * # noqa
8-
from awswrangler.quicksight._list import * # noqa
9-
from awswrangler.quicksight._utils import list_ingestions # noqa
3+
from awswrangler.quicksight._cancel import cancel_ingestion # noqa
4+
from awswrangler.quicksight._create import create_athena_data_source, create_athena_dataset, create_ingestion # noqa
5+
from awswrangler.quicksight._delete import ( # noqa
6+
delete_all_dashboards,
7+
delete_all_data_sources,
8+
delete_all_datasets,
9+
delete_all_templates,
10+
delete_dashboard,
11+
delete_data_source,
12+
delete_dataset,
13+
delete_template,
14+
)
15+
from awswrangler.quicksight._describe import ( # noqa
16+
describe_dashboard,
17+
describe_data_source,
18+
describe_data_source_permissions,
19+
describe_dataset,
20+
describe_ingestion,
21+
)
22+
from awswrangler.quicksight._get_list import ( # noqa
23+
get_dashboard_id,
24+
get_dashboard_ids,
25+
get_data_source_arn,
26+
get_data_source_arns,
27+
get_data_source_id,
28+
get_data_source_ids,
29+
get_dataset_id,
30+
get_dataset_ids,
31+
get_template_id,
32+
get_template_ids,
33+
list_dashboards,
34+
list_data_sources,
35+
list_datasets,
36+
list_group_memberships,
37+
list_groups,
38+
list_iam_policy_assignments,
39+
list_iam_policy_assignments_for_user,
40+
list_ingestions,
41+
list_templates,
42+
list_users,
43+
)

awswrangler/quicksight/_cancel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import boto3 # type: ignore
77

88
from awswrangler import _utils, exceptions
9-
from awswrangler.quicksight import _get
9+
from awswrangler.quicksight._get_list import get_dataset_id
1010

1111
_logger: logging.Logger = logging.getLogger(__name__)
1212

@@ -53,6 +53,6 @@ def cancel_ingestion(
5353
if account_id is None:
5454
account_id = _utils.get_account_id(boto3_session=session)
5555
if (dataset_id is None) and (dataset_name is not None):
56-
dataset_id = _get.get_dataset_id(name=dataset_name, account_id=account_id, boto3_session=session)
56+
dataset_id = get_dataset_id(name=dataset_name, account_id=account_id, boto3_session=session)
5757
client: boto3.client = _utils.client(service_name="quicksight", session=session)
5858
client.cancel_ingestion(IngestionId=ingestion_id, AwsAccountId=account_id, DataSetId=dataset_id)

awswrangler/quicksight/_create.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import boto3 # type: ignore
88

99
from awswrangler import _utils, exceptions
10-
from awswrangler.quicksight import _get
11-
from awswrangler.quicksight import _utils as _qs_utils
10+
from awswrangler.quicksight._get_list import get_data_source_arn, get_dataset_id
11+
from awswrangler.quicksight._utils import extract_athena_query_columns, extract_athena_table_columns
1212

1313
_logger: logging.Logger = logging.getLogger(__name__)
1414

@@ -279,14 +279,14 @@ def create_athena_dataset(
279279
if account_id is None:
280280
account_id = _utils.get_account_id(boto3_session=session)
281281
if (data_source_arn is None) and (data_source_name is not None):
282-
data_source_arn = _get.get_data_source_arn(name=data_source_name, account_id=account_id, boto3_session=session)
282+
data_source_arn = get_data_source_arn(name=data_source_name, account_id=account_id, boto3_session=session)
283283
if sql is not None:
284284
physical_table: Dict[str, Dict[str, Any]] = {
285285
"CustomSql": {
286286
"DataSourceArn": data_source_arn,
287287
"Name": sql_name,
288288
"SqlQuery": sql,
289-
"Columns": _qs_utils.extract_athena_query_columns(
289+
"Columns": extract_athena_query_columns(
290290
sql=sql,
291291
data_source_arn=data_source_arn, # type: ignore
292292
account_id=account_id,
@@ -300,7 +300,7 @@ def create_athena_dataset(
300300
"DataSourceArn": data_source_arn,
301301
"Schema": database,
302302
"Name": table,
303-
"InputColumns": _qs_utils.extract_athena_table_columns(
303+
"InputColumns": extract_athena_table_columns(
304304
database=database, # type: ignore
305305
table=table, # type: ignore
306306
boto3_session=session,
@@ -378,7 +378,7 @@ def create_ingestion(
378378
if (dataset_name is None) and (dataset_id is None):
379379
raise exceptions.InvalidArgument("You must pass a not None dataset_name or dataset_id argument.")
380380
if (dataset_id is None) and (dataset_name is not None):
381-
dataset_id = _get.get_dataset_id(name=dataset_name, account_id=account_id, boto3_session=session)
381+
dataset_id = get_dataset_id(name=dataset_name, account_id=account_id, boto3_session=session)
382382
if ingestion_id is None:
383383
ingestion_id = uuid.uuid4().hex
384384
client: boto3.client = _utils.client(service_name="quicksight", session=session)

awswrangler/quicksight/_delete.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@
66
import boto3 # type: ignore
77

88
from awswrangler import _utils, exceptions
9-
from awswrangler.quicksight import _get, _list
9+
from awswrangler.quicksight._get_list import (
10+
get_dashboard_id,
11+
get_data_source_id,
12+
get_dataset_id,
13+
get_template_id,
14+
list_dashboards,
15+
list_data_sources,
16+
list_datasets,
17+
list_templates,
18+
)
1019

1120
_logger: logging.Logger = logging.getLogger(__name__)
1221

@@ -63,7 +72,7 @@ def delete_dashboard(
6372
raise exceptions.InvalidArgument("You must pass a not None name or dashboard_id argument.")
6473
session: boto3.Session = _utils.ensure_session(session=boto3_session)
6574
if (dashboard_id is None) and (name is not None):
66-
dashboard_id = _get.get_dashboard_id(name=name, account_id=account_id, boto3_session=session)
75+
dashboard_id = get_dashboard_id(name=name, account_id=account_id, boto3_session=session)
6776
args: Dict[str, Any] = {
6877
"func_name": "delete_dashboard",
6978
"account_id": account_id,
@@ -112,7 +121,7 @@ def delete_dataset(
112121
raise exceptions.InvalidArgument("You must pass a not None name or dataset_id argument.")
113122
session: boto3.Session = _utils.ensure_session(session=boto3_session)
114123
if (dataset_id is None) and (name is not None):
115-
dataset_id = _get.get_dataset_id(name=name, account_id=account_id, boto3_session=session)
124+
dataset_id = get_dataset_id(name=name, account_id=account_id, boto3_session=session)
116125
args: Dict[str, Any] = {
117126
"func_name": "delete_data_set",
118127
"account_id": account_id,
@@ -159,7 +168,7 @@ def delete_data_source(
159168
raise exceptions.InvalidArgument("You must pass a not None name or data_source_id argument.")
160169
session: boto3.Session = _utils.ensure_session(session=boto3_session)
161170
if (data_source_id is None) and (name is not None):
162-
data_source_id = _get.get_data_source_id(name=name, account_id=account_id, boto3_session=session)
171+
data_source_id = get_data_source_id(name=name, account_id=account_id, boto3_session=session)
163172
args: Dict[str, Any] = {
164173
"func_name": "delete_data_source",
165174
"account_id": account_id,
@@ -210,7 +219,7 @@ def delete_template(
210219
raise exceptions.InvalidArgument("You must pass a not None name or template_id argument.")
211220
session: boto3.Session = _utils.ensure_session(session=boto3_session)
212221
if (template_id is None) and (name is not None):
213-
template_id = _get.get_template_id(name=name, account_id=account_id, boto3_session=session)
222+
template_id = get_template_id(name=name, account_id=account_id, boto3_session=session)
214223
args: Dict[str, Any] = {
215224
"func_name": "delete_template",
216225
"account_id": account_id,
@@ -245,7 +254,7 @@ def delete_all_dashboards(account_id: Optional[str] = None, boto3_session: Optio
245254
session: boto3.Session = _utils.ensure_session(session=boto3_session)
246255
if account_id is None:
247256
account_id = _utils.get_account_id(boto3_session=session)
248-
for dashboard in _list.list_dashboards(account_id=account_id, boto3_session=session):
257+
for dashboard in list_dashboards(account_id=account_id, boto3_session=session):
249258
delete_dashboard(dashboard_id=dashboard["DashboardId"], account_id=account_id, boto3_session=session)
250259

251260

@@ -272,7 +281,7 @@ def delete_all_datasets(account_id: Optional[str] = None, boto3_session: Optiona
272281
session: boto3.Session = _utils.ensure_session(session=boto3_session)
273282
if account_id is None:
274283
account_id = _utils.get_account_id(boto3_session=session)
275-
for dataset in _list.list_datasets(account_id=account_id, boto3_session=session):
284+
for dataset in list_datasets(account_id=account_id, boto3_session=session):
276285
delete_dataset(dataset_id=dataset["DataSetId"], account_id=account_id, boto3_session=session)
277286

278287

@@ -299,7 +308,7 @@ def delete_all_data_sources(account_id: Optional[str] = None, boto3_session: Opt
299308
session: boto3.Session = _utils.ensure_session(session=boto3_session)
300309
if account_id is None:
301310
account_id = _utils.get_account_id(boto3_session=session)
302-
for data_source in _list.list_data_sources(account_id=account_id, boto3_session=session):
311+
for data_source in list_data_sources(account_id=account_id, boto3_session=session):
303312
delete_data_source(data_source_id=data_source["DataSourceId"], account_id=account_id, boto3_session=session)
304313

305314

@@ -326,5 +335,5 @@ def delete_all_templates(account_id: Optional[str] = None, boto3_session: Option
326335
session: boto3.Session = _utils.ensure_session(session=boto3_session)
327336
if account_id is None:
328337
account_id = _utils.get_account_id(boto3_session=session)
329-
for template in _list.list_templates(account_id=account_id, boto3_session=session):
338+
for template in list_templates(account_id=account_id, boto3_session=session):
330339
delete_template(template_id=template["TemplateId"], account_id=account_id, boto3_session=session)

awswrangler/quicksight/_describe.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import boto3 # type: ignore
77

88
from awswrangler import _utils, exceptions
9-
from awswrangler.quicksight import _get
9+
from awswrangler.quicksight._get_list import get_dashboard_id, get_data_source_id, get_dataset_id
1010

1111
_logger: logging.Logger = logging.getLogger(__name__)
1212

@@ -50,7 +50,7 @@ def describe_dashboard(
5050
if account_id is None:
5151
account_id = _utils.get_account_id(boto3_session=session)
5252
if (dashboard_id is None) and (name is not None):
53-
dashboard_id = _get.get_dashboard_id(name=name, account_id=account_id, boto3_session=session)
53+
dashboard_id = get_dashboard_id(name=name, account_id=account_id, boto3_session=session)
5454
client: boto3.client = _utils.client(service_name="quicksight", session=session)
5555
return client.describe_dashboard(AwsAccountId=account_id, DashboardId=dashboard_id)["Dashboard"]
5656

@@ -94,7 +94,7 @@ def describe_data_source(
9494
if account_id is None:
9595
account_id = _utils.get_account_id(boto3_session=session)
9696
if (data_source_id is None) and (name is not None):
97-
data_source_id = _get.get_data_source_id(name=name, account_id=account_id, boto3_session=session)
97+
data_source_id = get_data_source_id(name=name, account_id=account_id, boto3_session=session)
9898
client: boto3.client = _utils.client(service_name="quicksight", session=session)
9999
return client.describe_data_source(AwsAccountId=account_id, DataSourceId=data_source_id)["DataSource"]
100100

@@ -138,7 +138,7 @@ def describe_data_source_permissions(
138138
if account_id is None:
139139
account_id = _utils.get_account_id(boto3_session=session)
140140
if (data_source_id is None) and (name is not None):
141-
data_source_id = _get.get_data_source_id(name=name, account_id=account_id, boto3_session=session)
141+
data_source_id = get_data_source_id(name=name, account_id=account_id, boto3_session=session)
142142
client: boto3.client = _utils.client(service_name="quicksight", session=session)
143143
return client.describe_data_source_permissions(AwsAccountId=account_id, DataSourceId=data_source_id)["Permissions"]
144144

@@ -182,7 +182,7 @@ def describe_dataset(
182182
if account_id is None:
183183
account_id = _utils.get_account_id(boto3_session=session)
184184
if (dataset_id is None) and (name is not None):
185-
dataset_id = _get.get_dataset_id(name=name, account_id=account_id, boto3_session=session)
185+
dataset_id = get_dataset_id(name=name, account_id=account_id, boto3_session=session)
186186
client: boto3.client = _utils.client(service_name="quicksight", session=session)
187187
return client.describe_data_set(AwsAccountId=account_id, DataSetId=dataset_id)["DataSet"]
188188

@@ -229,7 +229,7 @@ def describe_ingestion(
229229
if account_id is None:
230230
account_id = _utils.get_account_id(boto3_session=session)
231231
if (dataset_id is None) and (dataset_name is not None):
232-
dataset_id = _get.get_dataset_id(name=dataset_name, account_id=account_id, boto3_session=session)
232+
dataset_id = get_dataset_id(name=dataset_name, account_id=account_id, boto3_session=session)
233233
client: boto3.client = _utils.client(service_name="quicksight", session=session)
234234
return client.describe_ingestion(IngestionId=ingestion_id, AwsAccountId=account_id, DataSetId=dataset_id)[
235235
"Ingestion"

0 commit comments

Comments
 (0)