koordinates / kart-qgis-plugin

A QGIS integration plugin for Kart repositories. Distributed version-control for geospatial and tabular data.
https://kartproject.org
GNU General Public License v2.0
37 stars 16 forks source link

Can't import dataset from database (GDAL DLL) #78

Open MaelREBOUX opened 2 years ago

MaelREBOUX commented 2 years ago

Describe the bug

Really happy to test this famous plugin ! But with a fresh install of QGIS 3.16 and the kart plugin I can initialize a repo but cannot import a layer from a PostGIS database.

Reading the logs I don't know what is wrong. Help wanted...

Voluntary duplicate to #55

To Reproduce

Steps to reproduce the behavior:

  1. right-click on the repository in the kart plugin panel
  2. import dataset from database
  3. fill the connection informations
  4. choose a table / a layer
  5. Import

Then a modal dialog with errors appears :

127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
[22448] Failed to execute script 'kart_cli' due to unhandled exception!
Traceback (most recent call last):
File "kart_cli.py", line 4, in 
File "kart\cli.py", line 392, in entrypoint
File "click\core.py", line 1130, in __call__
File "click\core.py", line 1055, in main
File "kart\cli_util.py", line 68, in invoke
File "click\core.py", line 1657, in invoke
File "click\core.py", line 1404, in invoke
File "click\core.py", line 760, in invoke
File "click\decorators.py", line 26, in new_func
File "kart\tabular\import_.py", line 343, in import_
File "kart\fast_import.py", line 268, in fast_import_tables
File "kart\tabular\pk_generation.py", line 85, in wrap_sources_if_needed
File "kart\tabular\pk_generation.py", line 85, in 
File "kart\tabular\pk_generation.py", line 78, in wrap_source_if_needed
File "kart\tabular\import_source.py", line 156, in schema
File "kart\schema.py", line 274, in from_column_dicts
TypeError: 'NoneType' object is not iterable 

And in the kart panel :

2022-09-16T16:11:39     CRITICAL    ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_ECW_JP2ECW.dll
             127: La procédure spécifiée est introuvable.

             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_ECW_JP2ECW.dll
             127: La procédure spécifiée est introuvable.

             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_GEOR.dll
             127: La procédure spécifiée est introuvable.

             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_GEOR.dll
             127: La procédure spécifiée est introuvable.

             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_HDF5.dll
             127: La procédure spécifiée est introuvable.

             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_HDF5.dll
             127: La procédure spécifiée est introuvable.

             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_MG4Lidar.dll
             127: La procédure spécifiée est introuvable.
             [Showing only the first 20 lines]

But these plugins are present in the directory

image

Expected behavior To work

Version info (this is important!):

Kart v0.11.5, Copyright (c) Kart Contributors
» GDAL v3.3.2; PROJ v8.1.1
» PyGit2 v1.9.0; Libgit2 v1.4.2; Git v2.34.0.windows.1.13.g93318cbc8d
» SQLAlchemy v1.4.40; pysqlite3 v2.6.0/v3.31.1; SpatiaLite v5.0.0; Libpq v11.0.9
» SpatialIndex v1.9.3
pfw commented 2 years ago

Thanks for reporting this.

This looks to be a similar issue to how the GDAL import paths are being set incorrect, I'll confirm if this is the same cause and if a similar fix can sort it out.

MaelREBOUX commented 2 years ago

On my Windows system variables I get :

And because I have 2 PostgreSQL servers and 2 QGIS installed I get ogr2ogr in 4 places :

And by the game of the path variable, my current ogr2ogr.exe is the PG 13.8 one.

Hope this will help

MaelREBOUX commented 2 years ago

Hello any clue to test here on my workstation ?

pfw commented 2 years ago

Nothing immediately, I'm afraid. What did you use to install PostgresQL?

antoniolocandro commented 1 year ago

Having the same issue, importing from Postgresql gives the following error

image

Installed 14.5 using enterprisedb

https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

pfw commented 1 year ago

@antoniolocandro Could you double check the 'Import from Database' dialog for me to see that both 'host' and 'port' have values? I am able to recreate this issue when I specify a port, database, table, username and password but not hostname.

MaelREBOUX commented 1 year ago

Hello a colleague succeed to make kart work. There is an issue in the PG connection string that is raised. The int / str errot is linked to that. I have to double check this and I come back here.

pfw commented 1 year ago

@MaelREBOUX Thanks for the update - if it is something similar to my example above where there some parts of the connection info aren't present then that makes sense and I know what we need to sort out there.

antoniolocandro commented 1 year ago

This is what I input, very similar to what I have in DB manager in QGIS (probably would be better if plugin detected existing connections by default also)

image

Tables are loaded correctly including the corresponding schema but upon selecting one and hitting OK to load the message error pop ups

image

pfw commented 1 year ago

Thanksk @antoniolocandro that is what I expected, I'll work up a fix for that ASAP but in the meantime if you add localhost as the host in that dialog does it go through correctly?

antoniolocandro commented 1 year ago

Adding localhost solves the issue, hopefully existing connections would be detected and that would save some time