ckan / ckan/ckanext-spatial

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

Open
#270 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
XSLT
Stars
136
Forks
207
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce with bin/ckan_pycsw.py setup and load using the shown pycsw configuration and CKAN URL. Read bin/ckan_pycsw.py around the dataset query and the traceback location in pycsw/core/repository.py, then inspect why the PostgreSQL/PostGIS geometry lookup returns no row. Done should mean the load command handles the reported database state without the NoneType traceback and produces the expected dataset results.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.