Skip to content

Instantly share code, notes, and snippets.

@nkarnik
Last active August 29, 2015 14:11
Show Gist options
  • Save nkarnik/b90ee7aa20c141dd4c8f to your computer and use it in GitHub Desktop.
Save nkarnik/b90ee7aa20c141dd4c8f to your computer and use it in GitHub Desktop.
import zillabyte
import csv
cartodb_key = "YOUR_KEY_HERE"
map_name = "business_map"
class CartoEach:
def execute(self, controller, tup):
controller.emit({"tup" : tup, "cartodb_key" : cartodb_key, "map_name" : map_name})
app = zillabyte.app(name = "zilla_commerce")
stream = app.source_from_csv("businesses.csv", headers=["business"])
stream = stream.call_component("business_locator")
map_stream = stream.each(CartoEach)
map_stream = stream.call_component("sink_to_cartodb")
sink = stream.sink(name="business_locations", columns = [{"business":"string"},{"latitude":"float"},\
{"longitude":"float"},{"full_address":"string"},\
{"zip_code":"integer"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment