Created
January 10, 2015 18:41
-
-
Save fanzeyi/ec12b96591b18d197454 to your computer and use it in GitHub Desktop.
integrate GB2260 with SQLAlchemy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import gb2260 | |
import sqlalchemy.types as types | |
class ChineseDistrict(types.TypeDecorator): | |
impl = types.Integer | |
def process_bind_param(self, value, dialect): | |
return int(value.code) | |
def process_result_value(self, value, dialect): | |
return gb2260.get(value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment