ckan / ckanext-spatial

Geospatial extension for CKAN
http://docs.ckan.org/projects/ckanext-spatial
125 stars 192 forks source link

TyperError: 'NoneType' on self.postgis_geometry_column = str(row['f_geometry_column']) #270

Open didikw opened 2 years ago

didikw commented 2 years ago

I was run this command inside activated environtment py3: inside directory : /usr/lib/ckan/default/src/ckanext-spatial $python bin/ckan_pycsw.py load -p /etc/ckan/default/pycsw.cfg -u https://blablabla.org

got response:

bin/ckan_pycsw.py:248: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead. config = SafeConfigParser() creating new engine: postgresql://user:pwd@blablabla.pg.org/ckan_default binding ORM to existing database PostgreSQL+PostGIS+Native not picked up: records Traceback (most recent call last): File "/usr/lib/ckan/default/lib/python3.8/site-packages/pycsw-3.0.dev0-py3.8.egg/pycsw/core/repository.py", line 160, in init self.postgis_geometry_column = str(row['f_geometry_column']) TypeError: 'NoneType' object is not subscriptable setting repository queryables Started gathering CKAN datasets identifiers: 2021-12-28 12:53:36.181253 Gather finished (0 datasets): 2021-12-28 12:53:36.206973

---------------- >>>> Please what is the problem? <<<<-----------------------

I found this on line 78 (i do some adjustmen to the query) ====================/usr/lib/ckan/default/src/ckanext-spatial/bin/ckan_pycsw.py ===================== query = 'api/3/action/datastore_search?q={"fl":"id,metadata_modified,extras_harvest_object_id,extras_metadata_source", "q":"harvest_object_id:[\"\" TO *]", "limit":1000, "start":%s}'

query = 'api/3/action/datastore_search?resource_id=_table_metadata'

#query = 'api/3/action/package_search?json={"fl":"id,metadata_modified,extras_harvest_object_id,extras_metadata_source", "q":"harvest_object_id:[\\"\\" TO *]", "limit":1000, "start":%s}'
#query = 'api/search/dataset?qjson={"fl":"id,metadata_modified,extras_harvest_object_id,extras_metadata_source", "q":"harvest_object_id:[\\"\\" TO *]", "limit":1000, "start":%s}'

start = 0

gathered_records = {}

while True:
    url = ckan_url + query % start

=================================== @smellman @morty @kindly

and another try after delete table records and repeat setup command $python bin/ckan_pycsw.py setup -p /etc/ckan/default/pycsw.cfg

then load command $python bin/ckan_pycsw.py load -p /etc/ckan/default/pycsw.cfg -u https://blablabla.org gets this:

/usr/lib/ckan/default/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/base.py:3233: SAWarning: Did not recognize type 'geometry' of column 'wkb_geometry' util.warn( setting repository queryables Started gathering CKAN datasets identifiers: 2021-12-28 13:57:13.090627 Gather finished (0 datasets): 2021-12-28 13:57:13.116979

didikw commented 2 years ago

I run on postgre 10 and postgis 2.4

select * from geometry_columns;

f_table_catalog | f_table_schema | f_table_name | f_geometry_column | coord_dimension | srid | type -----------------+----------------+----------------+-------------------+-----------------+------+---------- ckan_default | public | package_extent | the_geom | 2 | 4326 | GEOMETRY ckan_default | public | records | wkb_geometry | 2 | 4326 | GEOMETRY

and wkb_geometry comes from ckan_pycsw.py setup command

CREATE TABLE "public"."Untitled" ( "identifier" text COLLATE "pg_catalog"."default" NOT NULL, "typename" text COLLATE "pg_catalog"."default" NOT NULL, "schema" text COLLATE "pg_catalog"."default" NOT NULL, "mdsource" text COLLATE "pg_catalog"."default" NOT NULL, "insert_date" text COLLATE "pg_catalog"."default" NOT NULL, "xml" varchar COLLATE "pg_catalog"."default" NOT NULL, "anytext" text COLLATE "pg_catalog"."default" NOT NULL, "metadata" varchar COLLATE "pg_catalog"."default", "metadata_type" text COLLATE "pg_catalog"."default" NOT NULL, "language" text COLLATE "pg_catalog"."default", "type" text COLLATE "pg_catalog"."default", "title" text COLLATE "pg_catalog"."default", "title_alternate" text COLLATE "pg_catalog"."default", "abstract" text COLLATE "pg_catalog"."default", "keywords" text COLLATE "pg_catalog"."default", "keywordstype" text COLLATE "pg_catalog"."default", "parentidentifier" text COLLATE "pg_catalog"."default", "relation" text COLLATE "pg_catalog"."default", "time_begin" text COLLATE "pg_catalog"."default", "time_end" text COLLATE "pg_catalog"."default", "topicategory" text COLLATE "pg_catalog"."default", "resourcelanguage" text COLLATE "pg_catalog"."default", "creator" text COLLATE "pg_catalog"."default", "publisher" text COLLATE "pg_catalog"."default", "contributor" text COLLATE "pg_catalog"."default", "organization" text COLLATE "pg_catalog"."default", "securityconstraints" text COLLATE "pg_catalog"."default", "accessconstraints" text COLLATE "pg_catalog"."default", "otherconstraints" text COLLATE "pg_catalog"."default", "date" text COLLATE "pg_catalog"."default", "date_revision" text COLLATE "pg_catalog"."default", "date_creation" text COLLATE "pg_catalog"."default", "date_publication" text COLLATE "pg_catalog"."default", "date_modified" text COLLATE "pg_catalog"."default", "format" text COLLATE "pg_catalog"."default", "source" text COLLATE "pg_catalog"."default", "crs" text COLLATE "pg_catalog"."default", "geodescode" text COLLATE "pg_catalog"."default", "denominator" text COLLATE "pg_catalog"."default", "distancevalue" text COLLATE "pg_catalog"."default", "distanceuom" text COLLATE "pg_catalog"."default", "wkt_geometry" text COLLATE "pg_catalog"."default", "servicetype" text COLLATE "pg_catalog"."default", "servicetypeversion" text COLLATE "pg_catalog"."default", "operation" text COLLATE "pg_catalog"."default", "couplingtype" text COLLATE "pg_catalog"."default", "operateson" text COLLATE "pg_catalog"."default", "operatesonidentifier" text COLLATE "pg_catalog"."default", "operatesoname" text COLLATE "pg_catalog"."default", "degree" text COLLATE "pg_catalog"."default", "classification" text COLLATE "pg_catalog"."default", "conditionapplyingtoaccessanduse" text COLLATE "pg_catalog"."default", "lineage" text COLLATE "pg_catalog"."default", "responsiblepartyrole" text COLLATE "pg_catalog"."default", "specificationtitle" text COLLATE "pg_catalog"."default", "specificationdate" text COLLATE "pg_catalog"."default", "specificationdatetype" text COLLATE "pg_catalog"."default", "platform" text COLLATE "pg_catalog"."default", "instrument" text COLLATE "pg_catalog"."default", "sensortype" text COLLATE "pg_catalog"."default", "cloudcover" text COLLATE "pg_catalog"."default", "bands" text COLLATE "pg_catalog"."default", "links" text COLLATE "pg_catalog"."default", "ckan_id" text COLLATE "pg_catalog"."default", "ckan_modified" text COLLATE "pg_catalog"."default", "anytext_tsvector" tsvector, "wkb_geometry" "public"."geometry", <<< ------------------------------------------------------ PRIMARY KEY ("identifier") ) ;

ALTER TABLE "public"."Untitled" OWNER TO "ckan_default";

CREATE INDEX "fts_gin_idx" ON "public"."Untitled" USING gin ( "anytext_tsvector" "pg_catalog"."tsvector_ops" );

CREATE INDEX "ix_records_abstract" ON "public"."Untitled" USING btree ( "abstract" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_accessconstraints" ON "public"."Untitled" USING btree ( "accessconstraints" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_bands" ON "public"."Untitled" USING btree ( "bands" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_ckan_id" ON "public"."Untitled" USING btree ( "ckan_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_classification" ON "public"."Untitled" USING btree ( "classification" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_cloudcover" ON "public"."Untitled" USING btree ( "cloudcover" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_conditionapplyingtoaccessanduse" ON "public"."Untitled" USING btree ( "conditionapplyingtoaccessanduse" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_contributor" ON "public"."Untitled" USING btree ( "contributor" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_couplingtype" ON "public"."Untitled" USING btree ( "couplingtype" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_creator" ON "public"."Untitled" USING btree ( "creator" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_crs" ON "public"."Untitled" USING btree ( "crs" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_date" ON "public"."Untitled" USING btree ( "date" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_date_creation" ON "public"."Untitled" USING btree ( "date_creation" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_date_modified" ON "public"."Untitled" USING btree ( "date_modified" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_date_publication" ON "public"."Untitled" USING btree ( "date_publication" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_date_revision" ON "public"."Untitled" USING btree ( "date_revision" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_degree" ON "public"."Untitled" USING btree ( "degree" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_denominator" ON "public"."Untitled" USING btree ( "denominator" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_distanceuom" ON "public"."Untitled" USING btree ( "distanceuom" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_distancevalue" ON "public"."Untitled" USING btree ( "distancevalue" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_format" ON "public"."Untitled" USING btree ( "format" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_geodescode" ON "public"."Untitled" USING btree ( "geodescode" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_insert_date" ON "public"."Untitled" USING btree ( "insert_date" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_instrument" ON "public"."Untitled" USING btree ( "instrument" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_keywords" ON "public"."Untitled" USING btree ( "keywords" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_keywordstype" ON "public"."Untitled" USING btree ( "keywordstype" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_language" ON "public"."Untitled" USING btree ( "language" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_lineage" ON "public"."Untitled" USING btree ( "lineage" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_links" ON "public"."Untitled" USING btree ( "links" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_mdsource" ON "public"."Untitled" USING btree ( "mdsource" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_operateson" ON "public"."Untitled" USING btree ( "operateson" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_operatesoname" ON "public"."Untitled" USING btree ( "operatesoname" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_operatesonidentifier" ON "public"."Untitled" USING btree ( "operatesonidentifier" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_operation" ON "public"."Untitled" USING btree ( "operation" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_organization" ON "public"."Untitled" USING btree ( "organization" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_otherconstraints" ON "public"."Untitled" USING btree ( "otherconstraints" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_parentidentifier" ON "public"."Untitled" USING btree ( "parentidentifier" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_platform" ON "public"."Untitled" USING btree ( "platform" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_publisher" ON "public"."Untitled" USING btree ( "publisher" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_relation" ON "public"."Untitled" USING btree ( "relation" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_resourcelanguage" ON "public"."Untitled" USING btree ( "resourcelanguage" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_responsiblepartyrole" ON "public"."Untitled" USING btree ( "responsiblepartyrole" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_schema" ON "public"."Untitled" USING btree ( "schema" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_securityconstraints" ON "public"."Untitled" USING btree ( "securityconstraints" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_sensortype" ON "public"."Untitled" USING btree ( "sensortype" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_servicetype" ON "public"."Untitled" USING btree ( "servicetype" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_servicetypeversion" ON "public"."Untitled" USING btree ( "servicetypeversion" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_source" ON "public"."Untitled" USING btree ( "source" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_specificationdate" ON "public"."Untitled" USING btree ( "specificationdate" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_specificationdatetype" ON "public"."Untitled" USING btree ( "specificationdatetype" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_specificationtitle" ON "public"."Untitled" USING btree ( "specificationtitle" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_time_begin" ON "public"."Untitled" USING btree ( "time_begin" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_time_end" ON "public"."Untitled" USING btree ( "time_end" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_title" ON "public"."Untitled" USING btree ( "title" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_title_alternate" ON "public"."Untitled" USING btree ( "title_alternate" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_topicategory" ON "public"."Untitled" USING btree ( "topicategory" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_type" ON "public"."Untitled" USING btree ( "type" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "ix_records_typename" ON "public"."Untitled" USING btree ( "typename" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );

CREATE INDEX "wkb_geometry_idx" ON "public"."Untitled" USING gist ( "wkb_geometry" "public"."gist_geometry_ops_2d" );

CREATE TRIGGER "ftsupdate" BEFORE INSERT OR UPDATE ON "public"."Untitled" FOR EACH ROW EXECUTE PROCEDURE "pg_catalog"."tsvector_update_trigger"('anytext_tsvector', 'pg_catalog.english', 'anytext');

CREATE TRIGGER "records_update_geometry" BEFORE INSERT OR UPDATE ON "public"."Untitled" FOR EACH ROW EXECUTE PROCEDURE "public"."records_update_geometry"();