Browse Source

chore: Code cleaning

pull/2/head
Michaël Costa 5 months ago
parent
commit
053b4bafc2
1 changed files with 6 additions and 13 deletions
  1. +6
    -13
      scrippy_db/db/__init__.py

+ 6
- 13
scrippy_db/db/__init__.py View File

@ -1,4 +1,3 @@
import sys
import logging
import psycopg2
import cx_Oracle
@ -10,16 +9,10 @@ class Db:
def __init__(self, username=None, host=None, database=None, port=None, password=None, service=None, db_type="postgres"):
"""Initialise le client."""
self.db_types = {
"postgres": {
"connect": self.connect_pgsql,
"execute": self.execute_pgsql,
},
"oracle": {
"connect": self.connect_oracle,
"execute": self.execute_oracle,
},
}
self.db_types = {"postgres": {"connect": self.connect_pgsql,
"execute": self.execute_pgsql},
"oracle": {"connect": self.connect_oracle,
"execute": self.execute_oracle}}
self.username = username
self.host = host
self.database = database
@ -114,7 +107,7 @@ class Db:
logging.debug(" '-> {} ligne(s) impactee(s)".format(self.cursor.rowcount))
try:
result = self.cursor.fetchall()
except cx_Oracle.InterfaceError as e:
except cx_Oracle.InterfaceError:
logging.debug(" '-> Aucun resultat a recuperer")
return None
if verbose:
@ -131,7 +124,7 @@ class Db:
logging.debug(" '-> {} ligne(s) impactee(s)".format(self.cursor.rowcount))
try:
result = self.cursor.fetchall()
except psycopg2.ProgrammingError as e:
except psycopg2.ProgrammingError:
logging.debug(" '-> Aucun resultat a recuperer")
return None
if verbose:


Loading…
Cancel
Save