scraperwiki / dumptruck

Painlessly move data in and out of a SQLite database.
http://sensiblecode.io
BSD 2-Clause "Simplified" License
43 stars 11 forks source link

Does not support column names with square brackets #21

Open zarino opened 10 years ago

zarino commented 10 years ago

Discovered by @IanHopkinson over here: https://github.com/scraperwiki/datatables-view-tool/issues/48

Given a database created with the following SQL commands:

CREATE TABLE data("hello[1]", "hello[^]", "goodbye");
INSERT INTO data VALUES ("first", "london", "berlin");
INSERT INTO data VALUES ("second", null, null);

Querying the database directly with the scraperwiki-python library:

import scraperwiki
print scraperwiki.sql.select('* from data')

Returns the incorrect column names:

[OrderedDict([
  (u'hello', u'london'), 
  (u'goodbye', u'berlin')
]), OrderedDict([
  (u'hello', None),
  (u'goodbye', None)
])]