-
Notifications
You must be signed in to change notification settings - Fork 419
Query does not processed #1135
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
Comments
Do you get an error? It's not clear from the description what the actual issue is. |
I got infinite loading when I execute this query. It does not even in .fetchall() but in session.execute(text()) line. Also asyncpg in python terminal with no sqlalchemy does not process query either it just stops. No logs no errors |
Upd: |
the issue with a local PostgreSQL install?: I use postgres on another local server
uvloop?: I am not sure
Sorry if i made smt wrong, that is my first issue.
I write query that works on postgres and i want to use it in my python code. Before that query there were not problems but now i have. I use python3.10.0 + fastapi + sqlalchemy + asyncpg as driver. The query ->
with foo as (select en.name, en.sources, en.id, x.* from crosstab($$ with d as (select source_id, date_trunc('day',dt) dt, sum(count_ev)::bigint val from events.v_stat_count where dt>=date_trunc('day', now()-'15d'::interval) and dt<=now() group by 1,2), s as (select distinct source_id from d)select s.source_id, x.dt, sum(coalesce(val,0))::bigint val from pg_catalog.generate_series(now()::date-interval '15d', now()::date, '1d') x(dt) cross join s left join d on d.dt=x.dt and d.source_id=s.source_id group by 1,2 order by 1,2 desc; $$) as x(source_id uuid, d1 bigint, d2 bigint, d3 bigint, d4 bigint, d5 bigint, d6 bigint, d7 bigint, d8 bigint, d9 bigint, d10 bigint, d11 bigint, d12 bigint, d13 bigint, d14 bigint, d15 bigint) join meta_data.event_name en on en.id =x.source_id order by 1,nlevel(en.sources) )select foo.name, end2.description,foo.id, foo.sources, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d1+d2+d3+d4+d5+d6+d7+d8+d9+d10+d11+d12+d13+d14+d15 as sumfrom foo left join meta_data.event_name enon en.sources = foo.sources left join nd.event_name_desc end2on end2.id = en.id
echo=True show
sqlalchemy.engine.Engine [generatedx in 0.00xxs] ()
and all. I write query using
session.execute(text(query))(it stops here) then _.fetchall()
Others queries work. If i change driver to psycopg(3) query works.
The text was updated successfully, but these errors were encountered: