Hello, I'm trying to create a new table in CartoDB using the GDAL CartoDB driver and Python bindings. I'm getting a HTTP 400 error.
This is the source code: from osgeo import ogr from osgeo import gdal gdal.SetConfigOption("CARTODB_API_KEY", MY_API_KEY) drv = ogr.GetDriverByName("CartoDB") cartodb_ds = drv.Open('cartodb:%s' % MY_ACCOUNT_NAME, update=1) if cartodb_ds is None: print 'Cannot open CartoDB connection for writing' cartodb_layer = cartodb_ds.CreateLayer('my_layer', geom_type=ogr.wkbMultiPolygon) Activating debug, this is what the driver sends to CartoDB: q=CREATE TABLE "my_layer" ( cartodb_id SERIAL, the_geom GEOMETRY(MULTIPOLYGON, 0), the_geom_webmercator GEOMETRY(MULTIPOLYGON, 3857),PRIMARY KEY (cartodb_id) );DROP SEQUENCE IF EXISTS "my_layer_cartodb_id_seq";CREATE SEQUENCE "my_layer_cartodb_id_seq" START 1;ALTER TABLE my_layer ALTER COLUMN cartodb_id SET DEFAULT nextval('my_layer_cartodb_id_seq')&api_key=1f1464a7f041a39568046b858af425abab4fefc6 And the response error message (HTTP error 400): CARTODB: RunSQL Response:{"error":["cannot drop sequence my_layer_cartodb_id_seq because other objects depend on it"]} If I get rid of all the SQL after the create table sentence itself, it works, and the table is created. I guess I could modify the driver to avoid this, but I'd like to know if someone is using it and having this problem. BTW, the tables created via SQL API don't appear in the CartoDB dashboard, but this is a known issue ( https://github.com/CartoDB/cartodb/issues/115) Best regards, -- Jorge Arevalo Freelance developer http://about.me/jorgeas80 _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev