Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing parameters ili2pg when password not set in pg_conf #76

Closed
sjib opened this issue Aug 30, 2022 · 10 comments
Closed

Missing parameters ili2pg when password not set in pg_conf #76

sjib opened this issue Aug 30, 2022 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@sjib
Copy link
Contributor

sjib commented Aug 30, 2022

When I want to import an INTERLIS file and have not set the password in the pg_conf of that database then qgepqwat2ili raises an error during schema creation that the --pwd parameter has no value.

@sjib sjib added bug Something isn't working enhancement New feature or request documentation Improvements or additions to documentation labels Aug 30, 2022
@sjib
Copy link
Contributor Author

sjib commented Aug 30, 2022

  1. Is this a behaviour that is ok like this and just the documentation should be updated?
  2. Or should the process be adjusted so that the interface asks for the missing password?
  3. Would we have to look at it a bit more general and discuss about the whole process of configuration with pg_config? Are there other methods used? Which ones?

Thanks for your feedbacks on this.

@urskaufmann
Copy link

Just document is a bad solution
Ask for missing password is a/the solution
Don't no anything about other methods

@olivierdalang
Copy link
Collaborator

Fix incoming here: #97

@sjib sjib removed documentation Improvements or additions to documentation enhancement New feature or request labels Mar 3, 2023
@ponceta
Copy link
Member

ponceta commented Mar 7, 2023

Can we close this since #97 is merged?

@sjib
Copy link
Contributor Author

sjib commented Mar 7, 2023

@ponceta Not clear for me - for Urs it seems to work, my tests did not work - see #97 (comment)

Maybe you could check also.

@ponceta
Copy link
Member

ponceta commented Mar 8, 2023

Maybe run the check with some other INTERLIS user?

I'll try it but I see that we have some key aspects which have to be tackle down like what QGIS auth methods are supported on TEKSI modules (according to the actual doc it is pg_services using pg_conf), but many users do use many different auth methods.

I created a new feature request here :
QGEP/QGEP#804

@olivierdalang
Copy link
Collaborator

olivierdalang commented Mar 8, 2023

Yes in Urs's case he doest not need a password, because he's somehow logged with his windows user (so it's not that his configuration is missing a password, it's that he can login without password).

The case where a password is needed, but the user does not want to store it in a pg_conf is indeed not handled. And there I 100% agree with Arnaud that there's so many different ways to configure this that we need to clarify what auth method we want to support and which we don't.

Btw I heard (but did not check yet) that since recently, ili2pg supports pgservice too, so we could use that directly instead of parsing the file (which obviously is a source of many potential issues). If that's confirmed, it's also an improvement we could keep in mind for the future. (actually not in ili2pg, but same code is implemented in modelbaker, so we can probably benefit from it once we move to modelbakerlib, see #65)

+1 for closing

@ponceta
Copy link
Member

ponceta commented Mar 14, 2023

Let's close this and reopen if any other user need is provided.

@ponceta ponceta closed this as completed Mar 14, 2023
@urskaufmann
Copy link

Does not work with QGEP Plugin 1.6.0-rc.4, if there is no password in the pg_service.conf:
KAU is not the database, KAU is the username!

Ein Fehler trat bei der Ausführung von Python-Code auf:

psycopg2.OperationalError: connection to server at "xxxx" (nnn.nnn.nn.nn), port 5432 failed: FATAL: database "KAU" does not exist
Traceback (most recent call last):
File "C:\Users/KAU/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\gui_init_.py", line 197, in action_do_export
create_ili_schema(
File "C:\Users/KAU/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\utils\ili2db.py", line 13, in create_ili_schema
connection = psycopg2.connect(get_pgconf_as_psycopg2_dsn())
File "C:\PROGRA~1\QGIS3\apps\Python39\lib\site-packages\psycopg2_init_.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server at "xxxx" (nnn.nnn.nn.nn), port 5432 failed: FATAL: database "KAU" does not exist

Python-Version: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]
QGIS-Version: 3.28.2-Firenze Firenze, b47e00ba601

Python-Pfad:
C:/PROGRA1/QGIS3/apps/qgis/./python
C:/Users/KAU/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/KAU/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA
1/QGIS3/apps/qgis/./python/plugins
C:\Program Files\QGIS3\bin\python39.zip
C:\PROGRA1\QGIS3\apps\Python39\DLLs
C:\PROGRA
1\QGIS3\apps\Python39\lib
C:\Program Files\QGIS3\bin
C:\Users\KAU\AppData\Roaming\Python\Python39\site-packages
C:\PROGRA1\QGIS3\apps\Python39
C:\PROGRA
1\QGIS3\apps\Python39\lib\site-packages
C:\PROGRA1\QGIS3\apps\Python39\lib\site-packages\win32
C:\PROGRA
1\QGIS3\apps\Python39\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS3\apps\Python39\lib\site-packages\Pythonwin
C:/Users/KAU/AppData/Roaming/QGIS/QGIS3\profiles\default/python
P:/Thun/Gemeinden/246 Krattigen/O1379 GEP Krattigen/qgep
C:\Users/KAU/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\gui....
.

@olivierdalang
Copy link
Collaborator

@urskaufmann In your log, I see FATAL: database "KAU" does not exist, it doesn't look like the original issue.

If that's the case (indeed we should deal with this and display an user friendly error for such connection errors), can you open a new issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants