diff globalneighbors/schema.py @ 1:1b94f3bf97e5

* limit distance function * start gridding * improve unicode handling
author Jeff Hammel <k0scist@gmail.com>
date Sat, 24 Jun 2017 14:02:14 -0700
parents 5dba84370182
children
line wrap: on
line diff
--- a/globalneighbors/schema.py	Sat Jun 24 12:03:39 2017 -0700
+++ b/globalneighbors/schema.py	Sat Jun 24 14:02:14 2017 -0700
@@ -69,6 +69,8 @@
 name = 'asciiname'
 primary_key = 'geonameid'
 
+# fields that should be unicode
+unicode_fields = ('name', 'asciiname')
 
 def cast_row(row, types=types):
     """
@@ -90,4 +92,6 @@
                 retval[key] = None
             else:
                 raise
+        if key in unicode_fields:
+            retval[key] = retval[key].decode('utf-8')
     return retval