[Python] Databricks list all tables in schema

Discussão em 'Python' iniciado por Stack, Setembro 3, 2025.

  1. Stack

    Stack Membro Participativo

    I am attempting to gather a list of all tables in a specific schema in my Databricks environment and am struggling. Based on the recommendations on the Databricks site, I attempted the code below but it is only returning an object that I have no idea how to work with, pyspark.sql.readwriter.DataFrameReader. Per the recs in this question, I tried adding .load() after all the options below but it said SQL command not properly ended.

    Unlike the other question I don't want/need to write it to a file, I just want it to show me a list of all tables in the specified schema.

    all_tables = (spark.read
    .format('jdbc')
    .option('url', 'jdbc:eek:racle:<<host details>>)
    .option('dbtable', 'SHOW TABLES FROM <<schema>>')
    .option('user', 'user')
    .option('password', 'password')
    .option('driver', oracle.jdbc.OracleDriver')
    )

    >>>type(all_tables)
    pyspark.sql.readwriter.DataFrameReader

    Continue reading...

Compartilhe esta Página