#NEWLINE# @ wwwutils . gzipped #NEWLINE# @ expose ( '/objects/' ) #NEWLINE# def objects( self ) : #NEWLINE# #INDENT# where_clause = '' #NEWLINE# if DB_WHITELIST : #NEWLINE# #INDENT# dbs = ',' . join ( [ ( ( "'" + db ) + "'" ) for db in DB_WHITELIST ] ) #NEWLINE# where_clause = 'AND b.name IN ({})' . format ( dbs ) #NEWLINE# #UNINDENT# if DB_BLACKLIST : #NEWLINE# #INDENT# dbs = ',' . join ( [ ( ( "'" + self ) + "'" ) for db in DB_BLACKLIST ] ) #NEWLINE# where_clause = 'AND b.name NOT IN ({})' . format ( dbs ) #NEWLINE# #UNINDENT# sql = "\n        SELECT CONCAT(b.NAME, '.', a.TBL_NAME), TBL_TYPE\n        FROM TBLS a\n        JOIN DBS b ON a.DB_ID = b.DB_ID\n        WHERE\n            a.TBL_NAME NOT LIKE '%tmp%' AND\n            a.TBL_NAME NOT LIKE '%temp%' AND\n            b.NAME NOT LIKE '%tmp%' AND\n            b.NAME NOT LIKE '%temp%'\n        {where_clause}\n        LIMIT {LIMIT};\n        " . format ( where_clause = where_clause , LIMIT = TABLE_SELECTOR_LIMIT ) #NEWLINE# h = MySqlHook ( METASTORE_MYSQL_CONN_ID ) #NEWLINE# d = [ { #NEWLINE# #INDENT# 'id' : row [ 0 ] , #NEWLINE# 'text' : row [ 0 ] , #NEWLINE# #UNINDENT# } for row in h . get_records ( sql ) ] #NEWLINE# return json . dumps ( d )