Skip to content

Drop schema error specificity #1032

@CBroz1

Description

@CBroz1

Feature Request

Problem

If I attempt to drop a schema referenced by a foreign key constraint, DataJoint returns a pymysql error that is difficult to parse for the average user not familiar with reading the backend snake case. In discussing other code that would catch this error, @dimitri-yatsenko suggested that "external code should not rely on pymysql errors because we may replace pymysql with another database connector"

dj.schema('prefix_abc')
OperationalError: (3730, "Cannot drop table '#a_b_c' referenced by a foreign key constraint '_table_position_ibfk_2' on table '_table_position'.")

Requirements

This feature should catch the underlying OperationalError and translate to camel case for the user as a DataJointError

Justification

Adding this feature would prevent a break in external code if DataJoint replaced pymysql

Alternative Considerations

Current workaround is to try/except the pymyql error

Metadata

Metadata

Labels

enhancementIndicates new improvements

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions