summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2018-11-17 11:26:05 -0800
committerGitHub <noreply@github.com>2018-11-17 11:26:05 -0800
commit0f0be9deab501b85f9d77d5233886505ba17abc5 (patch)
tree0d6657b75830573246b43a4e7421079cb9a6281d
parent462443a2d1d34d686eb11dd1b9b490c062e688a4 (diff)
parentec18ff014160f2ac5a7d98d567d8701311594c2f (diff)
Merge pull request #962 from DanEEStar/bugfix/named-queries-from-config
Bugfix for #938: load named queries from provided config file
-rw-r--r--AUTHORS2
-rw-r--r--changelog.rst5
-rw-r--r--pgcli/main.py4
-rw-r--r--pgcli/pgcompleter.py3
4 files changed, 8 insertions, 6 deletions
diff --git a/AUTHORS b/AUTHORS
index 9e78537e..50779ce4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -85,7 +85,7 @@ Contributors:
* Artur Balabanov
* Kenny Do
* Max Rothman
- * DanEEStar
+ * Daniel Egger
Creator:
--------
diff --git a/changelog.rst b/changelog.rst
index 50fc631d..bc2a6797 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -4,7 +4,8 @@ Upcoming:
Bug fixes:
----------
-Set default port in `connect_uri` when none is given. (Thanks: `DanEEStar`_)
+* Fix for loading/saving named queries from provided config file (#938). (Thanks: `Daniel Egger`_)
+* Set default port in `connect_uri` when none is given. (Thanks: `Daniel Egger`_)
* Fix for error listing databases (#951). (Thanks: `Irina Truong`_)
Internal:
@@ -899,5 +900,5 @@ Improvements:
.. _`Artur Balabanov`: https://github.com/arturbalabanov
.. _`Kenny Do`: https://github.com/kennydo
.. _`Max Rothman`: https://github.com/maxrothman
-.. _`DanEEStar`: https://github.com/DanEEStar
+.. _`Daniel Egger`: https://github.com/DanEEStar
.. _`Ignacio Campabadal`: https://github.com/igncampa
diff --git a/pgcli/main.py b/pgcli/main.py
index 696de5fa..86a86b1e 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -3,6 +3,8 @@ from __future__ import unicode_literals
import warnings
+from pgspecial.namedqueries import NamedQueries
+
warnings.filterwarnings("ignore", category=UserWarning, module='psycopg2')
import os
@@ -147,6 +149,8 @@ class PGCli(object):
# Load config.
c = self.config = get_config(pgclirc_file)
+ NamedQueries.instance = NamedQueries.from_config(self.config)
+
self.logger = logging.getLogger(__name__)
self.initialize_logging()
diff --git a/pgcli/pgcompleter.py b/pgcli/pgcompleter.py
index 7eaadc86..2ec0ac5a 100644
--- a/pgcli/pgcompleter.py
+++ b/pgcli/pgcompleter.py
@@ -21,9 +21,6 @@ from .config import load_config, config_location
_logger = logging.getLogger(__name__)
-NamedQueries.instance = NamedQueries.from_config(
- load_config(config_location() + 'config'))
-
Match = namedtuple('Match', ['completion', 'priority'])
_SchemaObject = namedtuple('SchemaObject', 'name schema meta')