init depot renew
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
from pycen import con
|
||||
|
||||
tab = 'rpg2020_ilots_anonymes_reg'
|
||||
vm_tab = 'vm_'+tab[:-3]+'isere'
|
||||
|
||||
|
||||
vm = '''
|
||||
CREATE MATERIALIZED VIEW ref_territoire.{vm_name}
|
||||
TABLESPACE pg_default
|
||||
AS SELECT s.*
|
||||
FROM ref_territoire.{table} s, ref_territoire.dept_isere reg
|
||||
WHERE ST_INTERSECTS(s.geom,reg.geom)
|
||||
WITH DATA;
|
||||
|
||||
-- View indexes:
|
||||
CREATE UNIQUE INDEX {vm_name}_idx ON ref_territoire.{vm_name} USING btree (id_ilot);
|
||||
CREATE INDEX {vm_name}_geom ON ref_territoire.{vm_name} USING gist (geom);
|
||||
'''.format(vm_name=vm_tab,table=tab)
|
||||
|
||||
with con.begin() as cnx:
|
||||
cnx.execute(vm)
|
||||
|
||||
Reference in New Issue
Block a user