diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f4c243 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config/conf.ini \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..27b53ca --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +## Manage PgSQL + +Module for python3 only. + +### Import and use + +``` +from manage_psql.manage_psql import HandlePsql + +MY_PSQL_CONN = HandlePsql() +MY_PSQL_CONN.psql_checkcon() +``` \ No newline at end of file diff --git a/check_conn.py b/check_conn.py new file mode 100644 index 0000000..3003c06 --- /dev/null +++ b/check_conn.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +from manage_psql.manage_psql import HandlePsql + +MY_PSQL_CONN = HandlePsql() +MY_PSQL_CONN.psql_conn() +print("PgSQL conncetion") + +STATE_CONN = MY_PSQL_CONN.psql_checkcon() +print("PgSQL connection status : {}".format(STATE_CONN)) + +print("PgSQL deconnection") +MY_PSQL_CONN.psql_unconn() diff --git a/manage_psql/config/conf.ini.sample b/config/conf.ini.sample similarity index 100% rename from manage_psql/config/conf.ini.sample rename to config/conf.ini.sample diff --git a/manage_psql/__init__.py b/manage_psql/__init__.py index 0d31332..c9009ff 100755 --- a/manage_psql/__init__.py +++ b/manage_psql/__init__.py @@ -26,9 +26,9 @@ except ImportError: sys.exit(1) try: - ini_conf = "./config/conf.ini" - config = SafeConfigParser() - config.read(ini_conf) -except config.Error as error: - print(error) - sys.exit(1) \ No newline at end of file + INI_CONF = "./config/conf.ini" + CONFIG = SafeConfigParser() + CONFIG.read(INI_CONF) +except CONFIG.Error as error: + print(error) + sys.exit(1) diff --git a/manage_psql/__pycache__/__init__.cpython-36.pyc b/manage_psql/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..c0269f5 Binary files /dev/null and b/manage_psql/__pycache__/__init__.cpython-36.pyc differ diff --git a/manage_psql/__pycache__/manage_psql.cpython-36.pyc b/manage_psql/__pycache__/manage_psql.cpython-36.pyc new file mode 100644 index 0000000..a1266b5 Binary files /dev/null and b/manage_psql/__pycache__/manage_psql.cpython-36.pyc differ