Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modularization: Worksheets modularization #449

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6ca3be0
Test change
dbalintx May 8, 2023
a5ce16a
Creating worksheets module, moving code from dataall/api
dbalintx May 8, 2023
82950fb
Moving worksheet resources from dataall/db to modules/worksheet
dbalintx May 9, 2023
f16c446
Outsourcing worksheet permissions to worksheet module
dbalintx May 9, 2023
ba135ff
Merge AthenaQueryResult object into Worksheet module and Common module
dbalintx May 10, 2023
258d42f
Move athena sql query business logic from resolver to service
dbalintx May 10, 2023
f92dca9
adding find_worksheet_share_by_uri method to worksheetrepository
dbalintx May 10, 2023
aebea6a
implementing moduleinterface for worksheets
dbalintx May 10, 2023
ee5d697
Merge branch 'modularization-main' of github.com:dbalintx/aws-dataall…
dbalintx May 10, 2023
bff29fc
move RUN_ATHENA_QUERY permission to worksheet permissions
dbalintx May 10, 2023
a44e2d4
rename worksheet service and permissions
dbalintx May 10, 2023
21d84ab
add groupresource for worksheet repository
dbalintx May 10, 2023
c996833
Add missing group resource registration to worksheets
dbalintx May 10, 2023
fdc8ad0
Fix circular imports, permission bug, tests are green
dbalintx May 11, 2023
a6a7a2b
move athena client from common to worksheets/aws
dbalintx May 11, 2023
443d6bf
Rename worksheets schema to types
dbalintx May 11, 2023
af8152e
Remove sharing of worksheets
dbalintx May 11, 2023
d2d397b
use decorator for resource permissions check for run_sql_query
dbalintx May 12, 2023
bbd58a2
Review findings
dbalintx May 12, 2023
22d2846
adding feed testhelper to separate feed tests from target types (curr…
dbalintx May 15, 2023
aa3c32c
moving session creation to athena client
dbalintx May 15, 2023
0b704a6
Fix migration scripts
dbalintx May 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions backend/dataall/api/Objects/AthenaQueryResult/__init__.py

This file was deleted.

83 changes: 0 additions & 83 deletions backend/dataall/api/Objects/AthenaQueryResult/helpers.py

This file was deleted.

45 changes: 0 additions & 45 deletions backend/dataall/api/Objects/AthenaQueryResult/schema.py

This file was deleted.

79 changes: 0 additions & 79 deletions backend/dataall/api/Objects/AthenaQueryResult/wrapper.py

This file was deleted.

1 change: 0 additions & 1 deletion backend/dataall/api/Objects/Feed/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ def types(cls):
return [gql.Ref(target_type) for target_type in cls._DEFINITIONS.keys()]


FeedRegistry.register(FeedDefinition("Worksheet", models.Worksheet))
FeedRegistry.register(FeedDefinition("DataPipeline", models.DataPipeline))
FeedRegistry.register(FeedDefinition("Dashboard", models.Dashboard))
2 changes: 0 additions & 2 deletions backend/dataall/api/Objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
SagemakerStudio,
RedshiftCluster,
Glossary,
AthenaQueryResult,
Worksheet,
Feed,
Notification,
Vpc,
Expand Down
8 changes: 0 additions & 8 deletions backend/dataall/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,4 @@ class Topic(GraphQLEnumMapper):
Misc = 'Misc'


class WorksheetRole(GraphQLEnumMapper):
Creator = '950'
Admin = '900'
SharedWithWritePermission = '500'
dbalintx marked this conversation as resolved.
Show resolved Hide resolved
SharedWithReadPermission = '400'
NoPermission = '000'


GLUEBUSINESSPROPERTIES = ['EXAMPLE_GLUE_PROPERTY_TO_BE_ADDED_ON_ES']
6 changes: 3 additions & 3 deletions backend/dataall/core/group/services/group_resource_manager.py
dbalintx marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


class GroupResource(ABC):
def count_resources(self, session, environment_uri, group_uri) -> int:
def count_resources(self, session, environment, group_uri) -> int:
raise NotImplementedError()


Expand All @@ -18,8 +18,8 @@ def register(resource: GroupResource):
GroupResourceManager._resources.append(resource)

@staticmethod
def count_group_resources(session, environment_uri, group_uri) -> int:
def count_group_resources(session, environment, group_uri) -> int:
counter = 0
for resource in GroupResourceManager._resources:
counter += resource.count_resources(session, environment_uri, group_uri)
counter += resource.count_resources(session, environment, group_uri)
return counter
1 change: 0 additions & 1 deletion backend/dataall/db/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@
from .sgm_studio_notebook import SgmStudioNotebook
from .dashboard import Dashboard
from .pipeline import Pipeline
from .worksheet import Worksheet
8 changes: 1 addition & 7 deletions backend/dataall/db/api/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ def validate_permissions(session, uri, g_permissions, group):
if permissions.CREATE_NETWORK in g_permissions:
g_permissions.append(permissions.LIST_ENVIRONMENT_NETWORKS)

g_permissions.append(permissions.RUN_ATHENA_QUERY)
g_permissions.append(permissions.GET_ENVIRONMENT)
g_permissions.append(permissions.LIST_ENVIRONMENT_GROUPS)
g_permissions.append(permissions.LIST_ENVIRONMENT_GROUP_PERMISSIONS)
Expand Down Expand Up @@ -370,11 +369,6 @@ def remove_group(session, username, groups, uri, data=None, check_perm=None):
models.Dashboard,
models.Dashboard.environmentUri == models.Environment.environmentUri,
)
.outerjoin(
models.WorksheetQueryResult,
models.WorksheetQueryResult.AwsAccountId
== models.Environment.AwsAccountId,
)
.filter(
and_(
models.Environment.environmentUri == environment.environmentUri,
Expand All @@ -391,7 +385,7 @@ def remove_group(session, username, groups, uri, data=None, check_perm=None):

group_env_objects_count += GroupResourceManager.count_group_resources(
session=session,
environment_uri=environment.environmentUri,
environment=environment,
group_uri=group
)

Expand Down
Loading