Python_scripts/5_GEONATURE/GN_ZH/tmp/insert_ddt_2024.py
2025-09-18 16:53:04 +02:00

23 lines
546 B
Python

import geopandas as gpd
from pycen import con_gn, update_to_sql
from sqlalchemy import DateTime
from os import path
PATH = '/home/colas/Documents/9_PROJETS/1_ZH/2024/CARTO/Couches SIG'
FILE = 'ZH_zh DDT 2024_MJ_modif 2025.shp'
df = (gpd.read_file(path.join(PATH, FILE))
.rename(columns={'Code ZH':'code','date':'update_date'}))
df['update_author'] = 24 # 24 = Mathieu Juton
update_to_sql(
df[['code','update_author', 'update_date']],
con_gn,
't_zh',
'pr_zh',
'code',
dtype={
'update_date': DateTime
}
)