From 5f141abaf5b6f93e82cffdfeff26be44bccae38d Mon Sep 17 00:00:00 2001 From: Sangat Das Date: Sun, 31 Jul 2022 23:23:21 -0700 Subject: [PATCH] Fixed 1 issue: Raise configuration error when using different backend --- planetmint/backend/connection.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/planetmint/backend/connection.py b/planetmint/backend/connection.py index 494e86d..b09cf0e 100644 --- a/planetmint/backend/connection.py +++ b/planetmint/backend/connection.py @@ -142,6 +142,19 @@ class Connection(metaclass=DBSingleton): :exc:`~ConnectionError`: If the connection to the database fails. """ + try: + backend = backend + if not backend and kwargs and kwargs.get("backend"): + backend = kwargs["backend"] + + if backend and backend != Config().get()["database"]["backend"]: + Config().init_config(backend) + else: + backend = Config().get()["database"]["backend"] + except KeyError: + logger.info("Backend {} not supported".format(backend)) + raise ConfigurationError + for attempt in self.max_tries_counter: if (self.conn is None): try: