[CG] : add read gn.t_zh

This commit is contained in:
Colas Geier 2023-07-31 11:56:35 +02:00
parent d038d4c1a1
commit aadf7313b6
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,3 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

22
pycen/geonature/pr_zh.py Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
def __read_gn__(sql,code):
from ..params import con_gn
from geopandas import read_postgis
return read_postgis(
sql,con_gn,
params={'code': tuple(code)} if code else None
)
def t_zh(code:str|list=None):
sql = 'SELECT * FROM pr_zh.t_zh'
if code:
sql += ' WHERE code IN %(code)s'
return __read_gn__(sql,code)
def v_synthese_for_export():
sql = 'SELECT * FROM gn_synthes.v_synthese_for_export'
return __read_gn__(sql)