Not able to access Table_tags in Databricks Apps:

shekharshukla
New Contributor II

When I try to fetch system.information_schema.schema_tags, it shows up but when I'm trying to fetch system.information_schema.table_tags it's not showing up and returns an empty df. Is there anything I am missing?

assert os.getenv('DATABRICKS_WAREHOUSE_ID'), "DATABRICKS_WAREHOUSE_ID must be set in app.yaml."

def sqlQuery(query: str) -> pd.DataFrame:
    cfg = Config()  # Pull environment variables for auth
    with sql.connect(
        server_hostname=cfg.host,
        http_path=f"/sql/1.0/warehouses/{os.getenv('DATABRICKS_WAREHOUSE_ID')}",
        credentials_provider=lambda: cfg.authenticate
    ) as connection:
        with connection.cursor() as cursor:
            cursor.execute(query)
            result = cursor.fetchall_arrow()
            if result is None or len(result) == 0:
                st.warning(f"Query '{query}' returned no dataa.")
                return pd.DataFrame()
            return result.to_pandas()

st.set_page_config(layout="wide")

@st.cache_data(ttl=5)  # only re-query if it's been 30 seconds
def getData():
    # Query the system.information_schema.table_tags table
    query = "SELECT * FROM system.information_schema.table_tags"
    print(query)
    df = sqlQuery(query)
    print(df)
    if df.empty:
        st.error("No data returned from system.information_schema.table_tags. Check table existence or permissions.")
    return df

data = getData()