6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/alet/irb/command/export.rb', line 6
def execute(arg)
soql =
if /\ASELECT/.match?(arg.strip.upcase)
arg
else
object = eval(arg)
object.to_soql if object&.instance_of? SObjectModel::QueryMethods::QueryCondition
end
return if soql.nil?
csv = sf.data.query(soql, format: :csv, target_org: ::Alet.config.connection.alias)
filename = "#{Time.now.strftime('%Y%m%d%H%M%S')}_export.csv"
File.open(filename, 'w'){|f| f.write(csv) }
puts filename
end
|