I suspected that SqlAlchemy and Elixir would be capable of versioning tables, but I couldn’t find the information I was looking for. Turns out it was in front of me the whole time:
Versioning a database
Nice way of versioning the contents of a database table: http://re.solve.se/database-versioning.
The link to the original idea: http://www.codeproject.com/KB/database/LisRecordVersioning.aspx.
Splitting strings in Python while not ignoring escape characters
Splitting strings in Python is easy:
[python]”this is a string”.split() # default delimiter is a space (‘ ‘)
# [‘this’, ‘is’, ‘a’, ‘string’]
[/python]
However, when your faced with escape characters, things become a tad more difficult:
[python]”this is\ a string”.split()
# [‘this’, ‘is\\’, ‘a’, ‘string’]
[/python]
Of course you could write your own split function that takes care of these escape characters, but there’s an easier way still:
[python]import cStringIO as c
import csv
csv.reader(c.StringIO(“this is\ a string”), delimiter=’ ‘, escapechar=’\\’).next()
# [‘this’, ‘is a’, ‘string’]
[/python]