HackerTrans
トップ新着トレンドコメント過去質問紹介求人

pgjones

no profile record

投稿

Show HN: SQL-tString a t-string SQL builder in Python

github.com
85 ポイント·投稿者 pgjones·昨年·35 コメント

Tell HN: Flask and Quart have now partially merged

20 ポイント·投稿者 pgjones·3 年前·7 コメント

Tips and techniques for modern Flask apps

pgjones.dev
2 ポイント·投稿者 pgjones·3 年前·0 コメント

Faster Routing for Flask and Quart

pgjones.dev
4 ポイント·投稿者 pgjones·4 年前·0 コメント

コメント

pgjones
·昨年·議論
The `sql_context` feature is meant to protect against SQL injection. I think for your usecase you would need to supply all columns, but you could used nested t-strings included based on whatever logic you need.
pgjones
·昨年·議論
It does parse the SQL. At the moment an expression is defined as all the text between the appropriate separators given the clause.
pgjones
·昨年·議論
Sorry that is a typo, I meant,

    with sql_context(columns={"x"}):
pgjones
·昨年·議論
Thank you! My Google foo did not find this.
pgjones
·昨年·議論
The presence of Absent removes the entire expression, and if that removal results in an empty clause (or group) it will remove that as well. For example if `a = Absent` `WHERE a = {a}` will remove everything, whereas `WHERE a = {a} AND b = {b}` will result in `WHERE b = {b}`.

> Do you support templating a sql tstring into an sql tstring for composition?

Yep
pgjones
·昨年·議論
Thanks, do you have a reference for SQL grammar - I've had no success finding an official source.
pgjones
·昨年·議論
If you want to see a usage for this I've built, and use, [SQL-tString](https://github.com/pgjones/sql-tstring) as an SQL builder.
pgjones
·2 年前·議論
Quart, the ASGI version of Flask, also has background tasks, https://quart.palletsprojects.com/en/latest/how_to_guides/ba..., and there is an extension Quart-Tasks, https://github.com/pgjones/quart-tasks, to run them on a schedule. Via

    @tasks.cron("*/5 * * * *")  # every 5 minutes
    async def infrequent_task():
        ...
In addition Hypercorn, https://github.com/pgjones/hypercorn, (a ASGI and WSGI) also does not use gunicorn, having migrated many years ago.
pgjones
·2 年前·議論
It is a shame GCRA is not more well known and used for rate limiting. It is, in my view, a better algorithm.

https://medium.com/smarkets/implementing-gcra-in-python-5df1... https://en.m.wikipedia.org/wiki/Generic_cell_rate_algorithm
pgjones
·3 年前·議論
Yes, I've written about this comparison in detail https://pgjones.dev/blog/fastapi-flask-quart-2022/.
pgjones
·3 年前·議論
There are new logos for all the Pallets projects and Pallets itself, based on a common theme.
pgjones
·3 年前·議論
https://pgjones.dev

I blog mostly about Python web developed, especially Flask, Quart and Hypercorn related aspects.
pgjones
·3 年前·議論
I've three things :),

1. Quart, https://quart.palletsprojects.com, an ASGI (async/await) re-implementation of the Python web MicroFramework Flask. It is now maintained alongside, by the same people, as Flask.

2. Hypercorn, https://hypercorn.readthedocs.io, an ASGI/WSGI server that supports HTTP/1, HTTP/2, and HTTP/3.

3. My book "A Blueprint for Production-Ready Web Applications", which uses both of the above and shows a beginner how to build a full stack app (React frontend) running on AWS. See https://pgjones.dev/tozo/ for details, code, and link to the example app.
pgjones
·4 年前·議論
It is also easier to manage for Flask - it is very mature and we fixed most of the issues present in FastAPI many years ago.
pgjones
·4 年前·議論
Flask supports async, see https://flask.palletsprojects.com/en/2.1.x/async-await/.

Also see Quart https://github.com/pgjones/quart (which is Flask re-implemented with async-await) and Quart-Schema, https://github.com/pgjones/quart-schema for swagger docs.
pgjones
·5 年前·議論
Or Hypercorn https://gitlab.com/pgjones/hypercorn if you want HTTP/1, HTTP/2, and HTTP/3.