mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 15:05:49 +00:00
added funcationilty to init a DB in case it hasn't been initialized before
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
6f62561793
commit
20860498df
@ -4,6 +4,7 @@
|
|||||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from jsonschema import SchemaError
|
||||||
import tarantool
|
import tarantool
|
||||||
|
|
||||||
from planetmint.config import Config
|
from planetmint.config import Config
|
||||||
@ -31,7 +32,10 @@ class TarantoolDB:
|
|||||||
"transactions", "inputs", "outputs", "keys"]
|
"transactions", "inputs", "outputs", "keys"]
|
||||||
|
|
||||||
def space(self, space_name: str):
|
def space(self, space_name: str):
|
||||||
return self.db_connect.space(space_name)
|
try:
|
||||||
|
return self.db_connect.space(space_name)
|
||||||
|
except tarantool.error.SchemaError:
|
||||||
|
return None
|
||||||
|
|
||||||
def get_connection(self):
|
def get_connection(self):
|
||||||
return self.db_connect
|
return self.db_connect
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user