Skip to content

Instantly share code, notes, and snippets.

@harlow
Last active January 6, 2017 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harlow/743b814f8d8b1d57d9adfcf83e27bfb7 to your computer and use it in GitHub Desktop.
Save harlow/743b814f8d8b1d57d9adfcf83e27bfb7 to your computer and use it in GitHub Desktop.
Ruby based ETL pipeline with Iron.io and Redshift
# lib/transformers/mixpanel/app_launched_event.rb
module Transformers
module Mixpanel
class AppLaunchEvent
def initialize(data)
@data = data
end
def csv_row
CSV.generate_line(ordinal_transformed_data)
end
private
def ordinal_transformed_data
# transformed data in ordinal column position
[
data['customer_id'],
device_id,
device_platform,
data['timestamp'],
# ...
]
end
def device_id
# Transformation of device identifier
end
def device_platform
# Transformation of device platform
end
attr_reader :data
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment