I’m working with a sqlite database, using python/django. I would need to have my results, which contain german umlauts (ä,ö,ü) to be correctly sorted (not with the umlauts at the end). Reading different articles on the web I’m not even sure if it is possible or not.
So any advise/instructions on that are appreciated. I already studied the docs for create_collation etc. but I couldn’t find any helpful examples for “beginners”. Furthermore, if it is possible I’d like to know how to apply the necessary modifications on already existing tables!
I’m working with a sqlite database, using python/django. I would need to have my
Share
To create a collation with
sqlite3, you need a function that works like C’sstrcmp.Note that although this collation will correctly handle
'ü' == 'Ü', it will still have'ü' > 'v', because the letters still sort in Unicode code point order after case folding. Writing a German-friendly collation function is left as an exercise to the reader. Or better, to the author of an existing Unicode library.You only need to modify the DB if you have an index that uses a collation you’ve overridden.
Dropthat index and re-createit.Note that any column with a
UNIQUE(orPRIMARY KEY) constraint will have an implicit index.