Skip to content

ENH: Allow TextClause #316

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

Merged
merged 1 commit into from
Sep 20, 2022
Merged

ENH: Allow TextClause #316

merged 1 commit into from
Sep 20, 2022

Conversation

bashtage
Copy link
Contributor

Allow sqlalchemy TextClause for sql select statements

  • Tests added: Please use assert_type() to assert the type of any return value

@@ -28,6 +28,10 @@ _SQLConnection = Union[
sqlite3.Connection,
]

_SQLStatement = Union[
str, sqlalchemy.sql.expression.Selectable, sqlalchemy.sql.elements.TextClause
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to import sqlalchemy.sql.elements

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, probably best to be consistent with Selectable and import it from sqlalchemy.sql.expression instead, rather than directly from the underlying module. sqlalchemy.sql.expression seems to be re-exporting a bunch of stuff from elements

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I agree expression is the right endpoint, also based on https://docs.sqlalchemy.org/en/14/core/sqlelement.html#sqlalchemy.sql.expression.TextClause

Allow sqlalchemy TextClause for sql select statements
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @bashtage

@Dr-Irv Dr-Irv merged commit 193095a into pandas-dev:main Sep 20, 2022
@bashtage bashtage deleted the text-clause-sql branch September 27, 2022 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants