Skip to content
Permalink
Browse files
[db_manager] Fix DBConnector.getSchemaTableName
Fix #15910
  • Loading branch information
arnaud-morvan committed Apr 28, 2017
1 parent 09d1263 commit cfe8dfedaea6f84c2512b9c4a28b81071fe236be
Showing with 3 additions and 1 deletion.
  1. +3 −1 python/plugins/db_manager/db_plugins/connector.py
@@ -213,7 +213,9 @@ def quoteString(self, txt):
def getSchemaTableName(self, table):
if not hasattr(table, '__iter__') and not isinstance(table, str):
return (None, table)
elif len(table) < 2:
if isinstance(table, str):
table = table.split('.')
if len(table) < 2:
return (None, table[0])
else:
return (table[0], table[1])

3 comments on commit cfe8dfe

@strk

This comment has been minimized.

Copy link
Contributor

@strk strk replied Jun 6, 2017

The first conditional seems wrong (not hasattrs and not isinstance...) because a str instance would not have __iter__ attribute, so the check is superflous, right ?

@arnaud-morvan

This comment has been minimized.

Copy link
Contributor Author

@arnaud-morvan arnaud-morvan replied Jul 7, 2017

This is a test for the case table parameter is "schemaname.tablename", this have caused db_manage to be unusable for a long time.

@arnaud-morvan

This comment has been minimized.

Copy link
Contributor Author

@arnaud-morvan arnaud-morvan replied Jul 7, 2017

Sorry, Missunderstood your comment, the first test seems to be for the case table parameter is not an instance of str (something else, like a TableDataModel or TableItem). Having a more explicit test would be better here.

Please sign in to comment.