inveniocfg: fix PostgreSQL test connection

* Use a SQLAlchemy's independent query to test connection.

* Create a dialect depending procedure to initially test the db.

Signed-off-by: Leonardo Rossi <leonardo.r@cern.ch>
146: D290 White spaces around docstring should be trimmed.
146: D202 No blank lines allowed *after* function docstring, found 1
155:12: F821 undefined name 'Error'
177:69: E502 the backslash is redundant between brackets
184:98: F821 undefined name 'os'
186:9: F821 undefined name 'sys'
190: D202 No blank lines allowed *after* function docstring, found 1
190: D400 First line should end with '.', not 't'
190: D205 Blank line missing between one-line summary and description
197:5: F401 'Integer' imported but unused
198:5: F401 'sessionmaker' imported but unused
211:13: E128 continuation line under-indented for visual indent
212:13: E128 continuation line under-indented for visual indent