mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Add-ons: Fix UTF8 problems with export-sql.py
This commit is contained in:
parent
7293de75b0
commit
92b5dfd83d
1 changed files with 4 additions and 4 deletions
|
@ -29,7 +29,7 @@ export-sql.py -- Export the taskwarrior database as a series of SQL commands.
|
||||||
|
|
||||||
Example usage::
|
Example usage::
|
||||||
|
|
||||||
$ ./export-sql.py | sqlite3 mytasks.db
|
$ PYTHONIOENCODING=UTF-8 ./export-sql.py | sqlite3 mytasks.db
|
||||||
$ /usr/bin/sqlite3 mytasks.db "select * from annotations;"
|
$ /usr/bin/sqlite3 mytasks.db "select * from annotations;"
|
||||||
|
|
||||||
This script has only been tested with sqlite3, but in theory, it could be
|
This script has only been tested with sqlite3, but in theory, it could be
|
||||||
|
@ -120,8 +120,8 @@ def to_sql(task):
|
||||||
values = template.format(**annot)
|
values = template.format(**annot)
|
||||||
return "INSERT INTO \"annotations\" VALUES(%s)" % values
|
return "INSERT INTO \"annotations\" VALUES(%s)" % values
|
||||||
|
|
||||||
template = "{uuid}, {description}, {entry}, {end}, " + \
|
template = u"{uuid}, {description}, {entry}, {end}, " + \
|
||||||
"{priority}, {project}, {status}"
|
u"{priority}, {project}, {status}"
|
||||||
|
|
||||||
nullables = ['end', 'priority', 'project', 'status']
|
nullables = ['end', 'priority', 'project', 'status']
|
||||||
defaults = dict([(key, None) for key in nullables])
|
defaults = dict([(key, None) for key in nullables])
|
||||||
|
@ -162,7 +162,7 @@ if __name__ == '__main__':
|
||||||
sql = table_definitions + ";\n".join(lines) + ';'
|
sql = table_definitions + ";\n".join(lines) + ';'
|
||||||
|
|
||||||
# Print them out, decorated with sqlite3 trappings
|
# Print them out, decorated with sqlite3 trappings
|
||||||
print """
|
print u"""
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
{sql}
|
{sql}
|
||||||
COMMIT;""".format(sql=sql)
|
COMMIT;""".format(sql=sql)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue