Skip to content

Commit

Permalink
new query logging
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 23, 2015
1 parent 03121b2 commit 2ab6809
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
8 changes: 5 additions & 3 deletions data/src/entity_mysql/system.py
Expand Up @@ -373,9 +373,11 @@ def execute_query(self, query, cursor = None, retries = 3):
# the queries that are considered slow
initial = time.time()

# executes the query in the current cursor
# context for the engine
cursor.execute(query)
# executes the query in the current cursor context
# for the engine, in case there's an exception during
# the execution of the query the query is logged
try: cursor.execute(query)
except: self.mysql_system.info("%s" % query); raise
final = time.time()

# verifies if the timing for the current executing query
Expand Down
10 changes: 6 additions & 4 deletions data/src/entity_pgsql/system.py
Expand Up @@ -42,7 +42,7 @@
import colony

try: import pgdb
except:
except:
try: import psycopg2; pgdb = psycopg2
except: import psycopg2cffi; pgdb = psycopg2cffi

Expand Down Expand Up @@ -298,9 +298,11 @@ def execute_query(self, query, cursor = None):
# the queries that are considered slow
initial = time.time()

# executes the query in the current cursor
# context for the engine
cursor.execute(query)
# executes the query in the current cursor context
# for the engine, in case there's an exception during
# the execution of the query the query is logged
try: cursor.execute(query)
except: self.pgsql_system.info("%s" % query); raise
final = time.time()

# verifies if the timing for the current executing query
Expand Down
8 changes: 5 additions & 3 deletions data/src/entity_sqlite/system.py
Expand Up @@ -264,9 +264,11 @@ def execute_query(self, query, cursor = None):
# the queries that are considered slow
initial = time.time()

# executes the query in the current cursor
# context for the engine
cursor.execute(query)
# executes the query in the current cursor context
# for the engine, in case there's an exception during
# the execution of the query the query is logged
try: cursor.execute(query)
except: self.sqlite_system.info("%s" % query); raise
final = time.time()

# verifies if the timing for the current executing query
Expand Down

0 comments on commit 2ab6809

Please sign in to comment.