class Blazer::Adapters::PrestoAdapter
Public Instance Methods
Source
# File lib/blazer/adapters/presto_adapter.rb, line 34 def parameter_binding end
TODO support prepared statements - prestodb.io/docs/current/sql/prepare.html feature request for variables - github.com/prestodb/presto/issues/5918
Source
# File lib/blazer/adapters/presto_adapter.rb, line 24 def preview_statement "SELECT * FROM {table} LIMIT 10" end
Source
# File lib/blazer/adapters/presto_adapter.rb, line 28 def quoting :single_quote_escape end
Source
# File lib/blazer/adapters/presto_adapter.rb, line 4 def run_statement(statement, comment) columns = [] rows = [] error = nil begin columns, rows = client.run("#{statement} /*#{comment}*/") columns = columns.map(&:name) rescue => e error = e.message end [columns, rows, error] end
Source
# File lib/blazer/adapters/presto_adapter.rb, line 19 def tables _, rows = client.run("SHOW TABLES") rows.map(&:first) end
Protected Instance Methods
Source
# File lib/blazer/adapters/presto_adapter.rb, line 39 def client @client ||= begin uri = URI.parse(settings["url"]) query = uri.query ? CGI.parse(uri.query) : {} cls = uri.scheme == "trino" ? Trino::Client : Presto::Client cls.new( server: "#{uri.host}:#{uri.port}", catalog: uri.path.to_s.delete_prefix("/"), schema: query["schema"] || "public", user: uri.user, http_debug: false ) end end