mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Fixed csvexport to write in primary key order.
Good news: This no longer relies on InnoDB's default row order. Bad news: InnoDB in MySQL 5.0 has a bug where it will sort rows physically according to a secondary index, if there's a composite primary key and a single-column index and the phase of the moon is right. So a couple tables have been, once again, reordered -- but correctly this time. Good news: This bug will no longer fuck me up!
This commit is contained in:
parent
cce9c26125
commit
64d3c7d5f1
4 changed files with 1895 additions and 1894 deletions
|
@ -142,7 +142,8 @@ def command_csvexport(engine_uri, directory='.'):
|
||||||
columns = [col.name for col in table.columns]
|
columns = [col.name for col in table.columns]
|
||||||
writer.writerow(columns)
|
writer.writerow(columns)
|
||||||
|
|
||||||
for row in session.query(table).all():
|
primary_key = table.primary_key
|
||||||
|
for row in session.query(table).order_by(*primary_key).all():
|
||||||
csvs = []
|
csvs = []
|
||||||
for col in columns:
|
for col in columns:
|
||||||
# Convert Pythony values to something more universal
|
# Convert Pythony values to something more universal
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue