summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Egger <daniel.egger@gmail.com>2018-10-31 18:42:27 +0100
committerDaniel Egger <daniel.egger@gmail.com>2018-10-31 18:46:04 +0100
commitb92743368bfc357f72a4046e899faef899ee9972 (patch)
tree1cfa99d9475d6121f73974da455b306b0e786f68
parent589c2abdfb329d343f5fcc41f674993677f01607 (diff)
Bugfix for #938: load named queries from provided config file
-rw-r--r--AUTHORS2
-rw-r--r--changelog.rst5
-rw-r--r--pgcli/main.py7
-rw-r--r--pgcli/pgcompleter.py3
4 files changed, 10 insertions, 7 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 650599e1..2a7505dc 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:
@@ -897,4 +898,4 @@ 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
diff --git a/pgcli/main.py b/pgcli/main.py
index ce3e88aa..446470e3 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -1,7 +1,10 @@
-from __future__ import unicode_literals
from __future__ import print_function
+from __future__ import unicode_literals
import warnings
+
+from pgspecial.namedqueries import NamedQueries
+
warnings.filterwarnings("ignore", category=UserWarning, module='psycopg2')
import os
@@ -146,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')