class Multiwoven::Integrations::Source::AmazonS3::Client

def discover(connection_config)

def discover(connection_config)
  connection_config = connection_config.with_indifferent_access
  @session_name = "discover-#{connection_config[:region]}-#{connection_config[:bucket]}"
  conn = create_connection(connection_config)
  # If pulling from multiple files, all files must have the same schema
  path = build_path(connection_config)
  records = get_results(conn, "DESCRIBE SELECT * FROM '#{path}';")
  columns = build_discover_columns(records)
  streams = [Multiwoven::Integrations::Protocol::Stream.new(name: path, action: StreamAction["fetch"], json_schema: convert_to_json_schema(columns))]
  catalog = Catalog.new(streams: streams)
  catalog.to_multiwoven_message
rescue StandardError => e
  handle_exception(e, { context: "AMAZONS3:DISCOVER:EXCEPTION", type: "error" })
end