Class: Superset::Database::Export
- Includes:
- FileUtilities
- Defined in:
- lib/superset/database/export.rb
Constant Summary collapse
- TMP_SUPERSET_DATABASE_PATH =
'/tmp/superset_database_exports'.freeze
Constants inherited from Request
Instance Attribute Summary collapse
-
#database_id ⇒ Object
readonly
Returns the value of attribute database_id.
-
#destination_path ⇒ Object
readonly
Returns the value of attribute destination_path.
-
#remove_dataset_yamls ⇒ Object
readonly
Returns the value of attribute remove_dataset_yamls.
Attributes inherited from Request
Instance Method Summary collapse
- #exported_zip_path ⇒ Object
-
#initialize(database_id:, destination_path:, remove_dataset_yamls: true) ⇒ Export
constructor
A new instance of Export.
- #perform ⇒ Object
- #response ⇒ Object
Methods included from FileUtilities
Methods inherited from Request
call, #query_params, #result, #superset_host
Methods included from Superset::Display
#display_headers, #headings, #list, #list_attributes, #result, #rows, #table, #title
Constructor Details
#initialize(database_id:, destination_path:, remove_dataset_yamls: true) ⇒ Export
Returns a new instance of Export.
24 25 26 27 28 |
# File 'lib/superset/database/export.rb', line 24 def initialize(database_id: , destination_path: , remove_dataset_yamls: true) @database_id = database_id @destination_path = destination_path.chomp('/') @remove_dataset_yamls = remove_dataset_yamls end |
Instance Attribute Details
#database_id ⇒ Object (readonly)
Returns the value of attribute database_id.
22 23 24 |
# File 'lib/superset/database/export.rb', line 22 def database_id @database_id end |
#destination_path ⇒ Object (readonly)
Returns the value of attribute destination_path.
22 23 24 |
# File 'lib/superset/database/export.rb', line 22 def destination_path @destination_path end |
#remove_dataset_yamls ⇒ Object (readonly)
Returns the value of attribute remove_dataset_yamls.
22 23 24 |
# File 'lib/superset/database/export.rb', line 22 def remove_dataset_yamls @remove_dataset_yamls end |
Instance Method Details
#exported_zip_path ⇒ Object
47 48 49 |
# File 'lib/superset/database/export.rb', line 47 def exported_zip_path @exported_zip_path ||= "#{tmp_uniq_database_path}/database_#{database_id}_export_#{datestamp}.zip" end |
#perform ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/superset/database/export.rb', line 30 def perform create_tmp_dir save_exported_zip_file unzip_files copy_export_files_to_destination_path Dir.glob("#{destination_path_with_db_id}/databases/*") end |
#response ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/superset/database/export.rb', line 39 def response @response ||= client.call( :get, client.url(route), client.param_check(params) ) end |