(filename)
return [name[0] for name in res]
get the names of the tables in an sqlite db as a list
get the names of the tables in an sqlite db as a list
get the names of the tables in an sqlite db as a list
def get_tablenames(filename):
        """get the names of the tables in an sqlite db as a list"""
        if not os.path.isfile(filename):
            raise IOError('file %s does not exist' % (filename))
        GET_TABLENAMES = 'SELECT name FROM sqlite_master WHERE type="table"'
        with sqlite3.connect(filename) as conn:
            cursor = conn.execute(GET_TABLENAMES)
            res = cursor.fetchall()

        return [name[0] for name in res]
def get_tablenames ( filename ) : if not os . path . isfile ( filename ) : raise IOError ( 'file %s does not exist' % ( filename ) ) GET_TABLENAMES = 'SELECT name FROM sqlite_master WHERE type="table"' with sqlite3 . connect ( filename ) as conn : cursor = conn . execute ( GET_TABLENAMES ) res = cursor . fetchall ( ) return [ name [ 0 ] for name in res ]