[pycsw-devel] Preparing Postgres/Postgis DB

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu May 23 13:21:00 PDT 2013


Hello all,

(I apologize if this is a simple question/answer)

I have created a new PostgreSQL database (named "pycsw-demo"), and
loaded the PostGIS extension (I'm using PostGIS 2.0.2).  So, this db has
a single existing table, named "spatial_ref_sys".

However when I try to setup_db it I get the following error, like it is
not happy that this spatial table already exists:

****
   python ./sbin/pycsw-admin.py -c setup_db -f default.cfg

	Initializing static context
	Creating database postgresql://postgres:xxxx@yyyyy:5435/pycsw-demo
	Creating table spatial_ref_sys
	Traceback (most recent call last):
	  File "./sbin/pycsw-admin.py", line 239, in <module>
	    admin.setup_db(DATABASE, TABLE, HOME)
	  File
"C:\Python26\Scripts\pycsw-workshop\lib\site-packages\pycsw\admin.py",
line 62, in
	setup_db
	    srs.create()
	  File "build\bdist.win32\egg\sqlalchemy\schema.py", line 614, in create
	  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1479, in
_run_visitor
	  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1122, in
_run_visitor
	  File "build\bdist.win32\egg\sqlalchemy\sql\visitors.py", line 111, in
traverse_single
	  File "build\bdist.win32\egg\sqlalchemy\engine\ddl.py", line 89, in
visit_table
	  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 662, in
execute
	  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 720, in
_execute_ddl
	  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 874, in
_execute_context
	  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 1024, in
_handle_dbapi_exce
	ption
	  File "build\bdist.win32\egg\sqlalchemy\util\compat.py", line 163, in
raise_from_cause
	  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 867, in
_execute_context
	  File "build\bdist.win32\egg\sqlalchemy\engine\default.py", line 324,
in do_execute
	sqlalchemy.exc.ProgrammingError: (ProgrammingError) relation
"spatial_ref_sys" already exi
	sts
	 '\nCREATE TABLE spatial_ref_sys (\n\tsrid SERIAL NOT NULL,
\n\tauth_name VARCHAR(256), \n
	\tauth_srid INTEGER, \n\tsrtext VARCHAR(2048), \n\tPRIMARY KEY
(srid)\n)\n\n' {}
****

Is there something like an append setting for setup_db ?

-jeff


-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/


More information about the pycsw-devel mailing list