@@ -293,31 +293,34 @@ def getTables(self, bruteForce=None):
293293 values = [(dbs [0 ], _ ) for _ in values ]
294294
295295 for db , table in filterPairValues (values ):
296- db = safeSQLIdentificatorNaming (db )
297- table = safeSQLIdentificatorNaming (unArrayizeValue (table ), True )
298-
299- if conf .getComments :
300- _ = queries [Backend .getIdentifiedDbms ()].table_comment
301- if hasattr (_ , "query" ):
302- if Backend .getIdentifiedDbms () in (DBMS .ORACLE , DBMS .DB2 ):
303- query = _ .query % (unsafeSQLIdentificatorNaming (db .upper ()), unsafeSQLIdentificatorNaming (table .upper ()))
296+ table = unArrayizeValue (table )
297+
298+ if not isNoneValue (table ):
299+ db = safeSQLIdentificatorNaming (db )
300+ table = safeSQLIdentificatorNaming (table , True )
301+
302+ if conf .getComments :
303+ _ = queries [Backend .getIdentifiedDbms ()].table_comment
304+ if hasattr (_ , "query" ):
305+ if Backend .getIdentifiedDbms () in (DBMS .ORACLE , DBMS .DB2 ):
306+ query = _ .query % (unsafeSQLIdentificatorNaming (db .upper ()), unsafeSQLIdentificatorNaming (table .upper ()))
307+ else :
308+ query = _ .query % (unsafeSQLIdentificatorNaming (db ), unsafeSQLIdentificatorNaming (table ))
309+
310+ comment = unArrayizeValue (inject .getValue (query , blind = False , time = False ))
311+ if not isNoneValue (comment ):
312+ infoMsg = "retrieved comment '%s' for table '%s' " % (comment , unsafeSQLIdentificatorNaming (table ))
313+ infoMsg += "in database '%s'" % unsafeSQLIdentificatorNaming (db )
314+ logger .info (infoMsg )
304315 else :
305- query = _ .query % (unsafeSQLIdentificatorNaming (db ), unsafeSQLIdentificatorNaming (table ))
316+ warnMsg = "on %s it is not " % Backend .getIdentifiedDbms ()
317+ warnMsg += "possible to get column comments"
318+ singleTimeWarnMessage (warnMsg )
306319
307- comment = unArrayizeValue (inject .getValue (query , blind = False , time = False ))
308- if not isNoneValue (comment ):
309- infoMsg = "retrieved comment '%s' for table '%s' " % (comment , unsafeSQLIdentificatorNaming (table ))
310- infoMsg += "in database '%s'" % unsafeSQLIdentificatorNaming (db )
311- logger .info (infoMsg )
320+ if db not in kb .data .cachedTables :
321+ kb .data .cachedTables [db ] = [table ]
312322 else :
313- warnMsg = "on %s it is not " % Backend .getIdentifiedDbms ()
314- warnMsg += "possible to get column comments"
315- singleTimeWarnMessage (warnMsg )
316-
317- if db not in kb .data .cachedTables :
318- kb .data .cachedTables [db ] = [table ]
319- else :
320- kb .data .cachedTables [db ].append (table )
323+ kb .data .cachedTables [db ].append (table )
321324
322325 if not kb .data .cachedTables and isInferenceAvailable () and not conf .direct :
323326 for db in dbs :
0 commit comments