CartoDB CSV Bulkloader for Python
✓ Published0🌍 Public
Aandrewxhill
Last edited Jun 19, 2013
Created on Jun 19, 2013
This example demonstrates a Python script that bulk-loads CSV data into a CartoDB table via the CartoDB SQL API, converting latitude and longitude columns into geometry using the CDB_LatLng function. It reads rows from a local CSV file, batches inserts of up to 25,000 rows per request, and skips records already present by checking a unique identifier against the table’s latest entry. The code uses Python’s csv, urllib2, and json modules to parse data and send HTTP POST requests, with error handling that writes failed SQL statements to a log file.
AI-generated description