Skip to content

Commit

Permalink
handle None cursor (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
danfrankj authored Aug 28, 2018
1 parent 68120a8 commit f88237c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions omniduct/caches/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def wrapped(method, self, *args, **kwargs):

if _renew or not _cache.has_key(_key, namespace=_namespace): # noqa: has_key is not of a dictionary here
value = method(self, **kwargs)
if value is None:
logger.warning("Method value returned None. Not saving to cache.")
return

try:
_cache.set(
_key,
Expand Down
2 changes: 1 addition & 1 deletion omniduct/databases/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def _dataframe_to_table(self, df, table, if_exists='fail', **kwargs):
raise NotImplementedError

def _cursor_empty(self, cursor):
return False
return cursor is None

def _parse_namespaces(self, name, level=0, defaults=None):
return ParsedNamespaces.from_name(
Expand Down
3 changes: 0 additions & 3 deletions omniduct/databases/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ def _dataframe_to_table(self, df, table, if_exists='fail', **kwargs):
return df.to_sql(name=table.table, schema=table.database, con=self.engine,
index=False, if_exists=if_exists, **kwargs)

def _cursor_empty(self, cursor):
return False

def _table_list(self, **kwargs):
return self.query("SHOW TABLES", **kwargs)

Expand Down

0 comments on commit f88237c

Please sign in to comment.