-
Notifications
You must be signed in to change notification settings - Fork 96
fix+refactor: backend-agnostic quoting, table name construction, and adapter abstractions #1419
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
Changes from 8 commits
4a9bc3d
b563047
5bae415
19f3e8b
fda5119
fd62c02
8de3714
c7f353f
7f1b902
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -486,19 +486,25 @@ def start_transaction(self) -> None: | |
| """ | ||
| if self.in_transaction: | ||
| raise errors.DataJointError("Nested connections are not supported.") | ||
| self.query(self.adapter.start_transaction_sql()) | ||
| sql = self.adapter.start_transaction_sql() | ||
| if sql: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted. Both MySQL and PostgreSQL always return non-empty transaction SQL. This was premature abstraction for hypothetical backends. |
||
| self.query(sql) | ||
| self._in_transaction = True | ||
| logger.debug("Transaction started") | ||
|
|
||
| def cancel_transaction(self) -> None: | ||
| """Cancel the current transaction and roll back all changes.""" | ||
| self.query(self.adapter.rollback_sql()) | ||
| sql = self.adapter.rollback_sql() | ||
| if sql: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted — see above. |
||
| self.query(sql) | ||
| self._in_transaction = False | ||
| logger.debug("Transaction cancelled. Rolling back ...") | ||
|
|
||
| def commit_transaction(self) -> None: | ||
| """Commit all changes and close the transaction.""" | ||
| self.query(self.adapter.commit_sql()) | ||
| sql = self.adapter.commit_sql() | ||
| if sql: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted — see above. |
||
| self.query(sql) | ||
| self._in_transaction = False | ||
| logger.debug("Transaction committed and closed.") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need quotes around these particular identifiers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right — these are plain identifiers (no reserved words, no special chars). Removed the quoting, just bare column names now.