Perfect, thank you! I wasn't aware of importlib.resources.
It's new. A good habit I've developed recently is to read all the PEPs since the last thing, and all the library changes. Python 3 is in full swing and some great things are in there already
Re:Simple SQL in Python
by hprotagonist on Thursday August 13, 2020 @06:50PM
(#24150616)
it’s only a decade old or so ;)
Oh it was a fun ten years
Re:Simple SQL in Python
by hprotagonist on Thursday August 13, 2020 @09:26PM
(#24152125)
i know how lucky i was to only start on 3.5. Avoided a LOT of pain.
You should check out the typing stuff in 3.8. Combined with mypy, gets a lot of the way there to statically checked python without the hassles of statically typed code.
The "^" marks a query returning one or zero values:
https://nackjicholson.github.io/aiosql/defining-sql-queries/...
Re:Simple SQL in Python
by kristjansson on Thursday August 13, 2020 @02:37PM
(#24146655)
I’ll unhelpfully note that I could swear I’ve seen something that does what you describe, and thought that this project was what I recalled - alas.
AnoSQL is a project along these lines I’ve seen on here before.
Re:Simple SQL in Python
by nackjicholson on Thursday August 13, 2020 @11:53PM
(#24153125)
I forked aiosql from anosql in order to support asyncio based sql drivers. Huge thanks to Honza Pokorny for starting this adventure.
Re:Simple SQL in Python
by kristjansson on Friday August 14, 2020 @12:47PM
(#24160181)
That’s the one, thank you!
It works nicely to use string formatting (`CREATE TABLE {table_name} ...`) for DDL along with interpolation (`WHERE user_id IN %(user_ids)s`) in the same query.