class Multiwoven::Integrations::Destination::DatabricksLakehouse::Client
def discover(connection_config)
def discover(connection_config) connection_config = connection_config.with_indifferent_access table_query = "SHOW TABLES IN #{connection_config[:catalog]}.#{connection_config[:schema]};" db = create_connection(connection_config) records = [] table_response = db.post("/api/2.0/sql/statements", generate_body(connection_config[:warehouse_id], table_query).to_json) table_response_body = JSON.parse(table_response.body) table_response_body["result"]["data_array"].each do |table| table_name = table[1] query = "DESCRIBE TABLE #{connection_config[:catalog]}.#{connection_config[:schema]}.#{table_name};" column_response = db.post("/api/2.0/sql/statements", generate_body(connection_config[:warehouse_id], query).to_json) column_response_body = JSON.parse(column_response.body) records << [table_name, column_response_body["result"]["data_array"]] end catalog = Catalog.new(streams: create_streams(records)) catalog.to_multiwoven_message rescue StandardError => e handle_exception( "DATABRICKS:LAKEHOUSE:DISCOVER:EXCEPTION", "error", e ) end