Skip to content

Commit

Permalink
Move imports to the top
Browse files Browse the repository at this point in the history
  • Loading branch information
gacarrillor committed Oct 1, 2024
1 parent c0dc97a commit 7453239
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 3 additions & 4 deletions modelbaker/db_factory/pg_command_config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@ def get_uri(self, su: bool = False, qgis: bool = False) -> str:
)
):
if qgis:
# only provide authcfg to the uri when it's needed for QGIS specific things
uri += ["authcfg={}".format(self.configuration.dbauthid)]
else:
# Operations like Export do not require superuser
# login and may be run with authconfig
from ..utils.db_utils import get_authconfig_map

authconfig_map = get_authconfig_map(self.configuration.dbauthid)
authconfig_map = db_utils.get_authconfig_map(
self.configuration.dbauthid
)
uri += ["user={}".format(authconfig_map.get("username"))]
uri += ["password={}".format(authconfig_map.get("password"))]
else:
Expand Down
5 changes: 1 addition & 4 deletions modelbaker/iliwrapper/ili2dbargs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from qgis.PyQt.QtCore import QDir, QFile

from ..utils.db_utils import get_authconfig_map
from .globals import DbIliMode
from .ili2dbconfig import SchemaImportConfiguration

Expand Down Expand Up @@ -55,8 +56,6 @@ def _get_db_args(configuration, hide_password=False):
elif configuration.dbauthid:
# Operations like Export can work with authconf
# and with no superuser login
from ..utils.db_utils import get_authconfig_map

authconfig_map = get_authconfig_map(configuration.dbauthid)
db_args += ["--dbusr", authconfig_map.get("username")]
else:
Expand All @@ -80,8 +79,6 @@ def _get_db_args(configuration, hide_password=False):
elif configuration.dbauthid:
# Operations like Export can work with authconf
# and with no superuser login
from ..utils.db_utils import get_authconfig_map

authconfig_map = get_authconfig_map(configuration.dbauthid)
db_args += ["--dbpwd", authconfig_map.get("password")]

Expand Down

0 comments on commit 7453239

Please sign in to comment.