Class: Superset::Sqllab::Execute

Inherits:
Request
  • Object
show all
Defined in:
lib/superset/sqllab/execute.rb

Defined Under Namespace

Classes: InvalidParameterError

Constant Summary

Constants inherited from Request

Request::PAGE_SIZE

Instance Attribute Summary collapse

Attributes inherited from Request

#page_num

Instance Method Summary collapse

Methods inherited from Request

call, #result, #superset_host

Methods included from Display

#display_headers, #headings, #list, #list_attributes, #result, #rows, #table, #title

Constructor Details

#initialize(database_id:, query:, schema: 'public', query_limit: 1000) ⇒ Execute

Returns a new instance of Execute.



8
9
10
11
12
13
# File 'lib/superset/sqllab/execute.rb', line 8

def initialize(database_id: , query: , schema: 'public', query_limit: 1000)
  @database_id = database_id
  @query = query
  @schema = schema
  @query_limit = query_limit
end

Instance Attribute Details

#database_idObject (readonly)

Returns the value of attribute database_id.



6
7
8
# File 'lib/superset/sqllab/execute.rb', line 6

def database_id
  @database_id
end

#queryObject (readonly)

Returns the value of attribute query.



6
7
8
# File 'lib/superset/sqllab/execute.rb', line 6

def query
  @query
end

#query_limitObject (readonly)

Returns the value of attribute query_limit.



6
7
8
# File 'lib/superset/sqllab/execute.rb', line 6

def query_limit
  @query_limit
end

#schemaObject (readonly)

Returns the value of attribute schema.



6
7
8
# File 'lib/superset/sqllab/execute.rb', line 6

def schema
  @schema
end

Instance Method Details

#dataObject



25
26
27
# File 'lib/superset/sqllab/execute.rb', line 25

def data
  response["data"]
end

#performObject



15
16
17
18
19
# File 'lib/superset/sqllab/execute.rb', line 15

def perform
  validate_constructor_args
  response
  data
end

#responseObject



21
22
23
# File 'lib/superset/sqllab/execute.rb', line 21

def response
  @response ||= client.post(route, query_params)
end