copy_from_query drops headers if any postgis NOTICE/LOCATION messages produced
还没有人认领这个 Issue。
评估
调研方向
从 Connection.copy_from_query 开始,在启用 PostGIS NOTICE/LOCATION 消息的情况下,针对 PostgreSQL 重现所提供的 COPY 查询。跟踪这些消息如何与 COPY 输出一起被处理;当产生此类通知时,返回的数据仍保留其 CSV 标头,即表示完成。
由索引模型根据 Issue 内容生成。
描述
when using Connection.copy_from_query I had a statement which eventually resolved to something like:
COPY (
select 1
from field_year_crop_variety_layer fycvl
cross join filters
join field_meta fm on
fm.field_id = fycvl.field_id and
(filters.filter_geometry is null or st_intersects(filters.filter_geometry, fm.centroid))
order by fycvl.field_id, fycvl.harvest_year, fycvl.layer_id, fycvl.crop, fycvl.variety
limit '100000'::int
) TO STDOUT (FORMAT 'csv', HEADER True)
where filter_geometry is a geometry, and fm.centroid is a geography.
and no matter what I did asyncpg would not return the headers. It wasn't until I broke it down and ran it from psql that I noticed the output:
field_id,harvest_year,layer_id,crop,variety,is_precision_data,date_period,avg_date,data_is_missing,missing_data_message,crop_variety_layer_area_m2,geometry,computed_at
NOTICE: 00000: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY
LOCATION: geography_from_geometry, geography_inout.c:510
NOTICE: 00000: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY
LOCATION: geography_from_geometry, geography_inout.c:510
143011,2017,0,corn,unknown,t,"[2017-04-25,2017-04-26)",2017-04-24,f,,7240.833,,1752130305.616610
sure enough, if I fixed the bug (casting fm.centroid to a geometry) the headers appeared. This seems like a bug in asyncpg when interpreting the data returned.
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 469
- 平均合并
- 4 小时 42 分钟
- 30 天内合并 PR
- 6
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MagicStack/asyncpg 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
MagicStack/asyncpg#1357 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
MagicStack/asyncpg#997 ·
-
Connection.close(timeout=) waits forever on a pending cancel when the server never acknowledges it 未关闭
难度 4/5 3-5 天 新手友好度 68/100
MagicStack/asyncpg#1356 ·
-
难度 4/5 3-5 天 新手友好度 48/100
MagicStack/asyncpg#1354 ·
-
难度 3/5 1-2 天 新手友好度 72/100
MagicStack/asyncpg#1342 ·
查看 MagicStack/asyncpg 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 88/100
use-agent-os/agent-os#3314 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
BasedHardware/omi#15662 · 1 条评论 ·
-
documentation help wanted
难度 2/5 1-3 小时 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 62/100
AiursoftWeb/AnduinOS-2#19 ·