[CG] : add fct dump database

This commit is contained in:
Colas Geier 2023-07-04 14:23:36 +02:00
parent 079f22ae3a
commit 0d2b1fa9c6

View File

@ -405,4 +405,13 @@ def Polygons_to_MultiPolygon(df,geom_col=None):
poly[geom_col] = [MultiPolygon([geom]) for geom in df.loc[df.geom_type=='Polygon',geom_col] ]
df = concat([multi,poly])
df.sort_index(inplace=True)
return df
return df
def dump_bd(host,bd_name, user):
from os import system
from datetime import datetime as dt
date = dt.today().date().isoformat().replace('-','')
cmd = 'pg_dump -h {h} -U {u} -W -F c {bd} > {bd}_{dat}.dump'.format(
h=host,u=user,bd=bd_name,dat=date
)
system(cmd)