dataall icon indicating copy to clipboard operation
dataall copied to clipboard

Unstable alembic behaviour

Open SofiaSazonova opened this issue 5 months ago • 0 comments

Describe the bug

revision = '852cdf6cf1e0' While executing code

PermissionService.save_permission(
            session,
            name=perm,
            description=ENVIRONMENT_REDSHIFT_ALL_WITH_DESC[perm],
            permission_type=PermissionType.RESOURCE.name,
        )

the DB_migration handler throws an error, while performing 'find permission' select:

[SQL: SELECT permission."permissionUri" AS "permission_permissionUri", permission.name AS permission_name, permission.type AS permission_type, permission.description AS permission_description, permission.created AS permission_created, permission.updated AS permission_updated   FROM permission WHERE permission.name = %(name_1)s AND permission.type = %(type_1)s LIMIT %(param_1)s]
[parameters: {'name_1': 'LIST_ENVIRONMENT_REDSHIFT_CONNECTIONS', 'type_1': 'RESOURCE', 'param_1': 1}]

Only information in the logs: (Background on this error at: http://sqlalche.me/e/13/2j85 )

The problem is unclear. The same issue was reported here but has no answer yet.

How to Reproduce

It certainly does not appear when all migrations are executed at once. It doesn't depend on whether the permissions exist in DB or not.

apply this to the target database

alembic -c backend/alembic.ini downgrade 7c5b30fee306   
alembic -c backend/alembic.ini upgrade 852cdf6cf1e0    

Expected behavior

If we can't find the proper fix, I suggest to rewrite saving permission using alembic 'execute'

Your project

No response

Screenshots

No response

OS

macOs Sonoma 14.2

Python version

3.11

AWS data.all version

2.3.0

Additional context

No response

SofiaSazonova avatar Sep 12 '24 13:09 SofiaSazonova