class Multiwoven::Integrations::Source::Postgresql::Client

def read(sync_config)

def read(sync_config)
  connection_config = sync_config.source.connection_specification
  connection_config = connection_config.with_indifferent_access
  query = sync_config.model.query
  query = batched_query(query, sync_config.limit, sync_config.offset) unless sync_config.limit.nil? && sync_config.offset.nil?
  db = create_connection(connection_config)
  query(db, query)
rescue StandardError => e
  handle_exception(e, {
                     context: "POSTGRESQL:READ:EXCEPTION",
                     type: "error",
                     sync_id: sync_config.sync_id,
                     sync_run_id: sync_config.sync_run_id
                   })
ensure
  db&.close
end