Class: Dynamocli::Import
- Inherits:
-
Object
- Object
- Dynamocli::Import
- Defined in:
- lib/dynamocli/import.rb
Constant Summary collapse
- LOGGER =
TTY::Logger.new
- SUPPORTED_FILE_FORMATS =
["CSV"]
Instance Method Summary collapse
-
#initialize(file:, table:, exported_from_aws: false) ⇒ Import
constructor
A new instance of Import.
- #start ⇒ Object
Constructor Details
#initialize(file:, table:, exported_from_aws: false) ⇒ Import
Returns a new instance of Import.
11 12 13 14 15 16 |
# File 'lib/dynamocli/import.rb', line 11 def initialize(file:, table:, exported_from_aws: false) @file = file @table = table @exported_from_aws = exported_from_aws @dynamodb = Aws::DynamoDB::Client.new end |
Instance Method Details
#start ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/dynamocli/import.rb', line 18 def start records = get_records write_records_to_dynamodb_table(records) LOGGER.success("#{records.size} record#{"s" if records.size != 1} imported to #{table}") rescue Aws::DynamoDB::Errors::ValidationException => e LOGGER.error(e.) exit(42) end |