-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add SQL runner utility .io.sql.run_sql
#74
Conversation
dfd535f
to
71e67ff
Compare
cratedb_toolkit.shell.run_sql
utility primitivecratedb_toolkit.io.sql.run_sql
utility primitive
ead3c71
to
d604d81
Compare
cratedb_toolkit.io.sql.run_sql
utility primitive.io.sql.run_sql
d604d81
to
c8336ea
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
📢 Thoughts on this report? Let us know! |
d7bae2d
to
108a992
Compare
108a992
to
486e720
Compare
sql_effective: str | ||
if isinstance(sql, str): | ||
sql_effective = sql | ||
elif isinstance(sql, Path): | ||
sql_effective = sql.read_text() | ||
elif isinstance(sql, io.IOBase): | ||
sql_effective = sql.read() | ||
else: | ||
raise TypeError("SQL statement type must be either string, Path, or IO handle") |
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.
Just curious: couldn't this be done by using function overloads with @typing.overload()
instead?
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.
Hi. I have to admit I never used it. If you think the code can be improved, I will be happy to learn about it.
About
Classical yak shaving.
Details
Similar to pyveci/pueblo#12, this patch adds a generalized testing helper function to avoid code duplication within the educational repository cratedb-examples, originally conceived at 1. We need this utility function at many more spots, so we needed to find a good place to store it.
Synopsis
Notes
Note that details on the interface may change while we go, specifically on the "naming things" / DWIM side of things. If you have any suggestions, feel free to add your voice.
/cc @karynzv, @marijaselakovic, @hlcianfagna, @hammerhead, @WalBeh, @andnig, @ckurze, @vvulf
Footnotes
https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/test.py ↩