Class: Aliyun::Odps::DownloadSession

Inherits:
Struct::Base show all
Defined in:
lib/aliyun/odps/tunnel/download_session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct::Base

#initialize, property, #update_attrs

Constructor Details

This class inherits a constructor from Aliyun::Odps::Struct::Base

Instance Attribute Details

#clientClient



8
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 8

property :client, Client, required: true

#download_idString



10
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 10

property :download_id, String, required: true

#initiatedDateTime



16
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 16

property :initiated, DateTime

#ownerString



15
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 15

property :owner, String

#partition_specString



12
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 12

property :partition_spec, String

#projectProject



7
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 7

property :project, Project, required: true

#record_countInteger



13
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 13

property :record_count, Integer

#schemaHash



17
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 17

property :schema, Hash

#statusString



14
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 14

property :status, String

#table_nameString



11
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 11

property :table_name, String, required: true

Instance Method Details

#download(start, count, columns, encoding = 'raw') ⇒ Raw Data

Download data



29
30
31
32
33
34
35
36
37
# File 'lib/aliyun/odps/tunnel/download_session.rb', line 29

def download(start, count, columns, encoding = 'raw')
  path = "/projects/#{project.name}/tables/#{table_name}"

  query = build_download_query(start, count, columns)
  headers = build_download_headers(encoding)

  resp = client.get(path, query: query, headers: headers)
  protobufed2records(resp.parsed_response, resp.headers['content-encoding'], columns)
end