Merge lp:~timkuhlman/ubuntu-geonames/column-size-fiz into lp:ubuntu-geonames

Proposed by Tim Kuhlman
Status: Merged
Merged at revision: 31
Proposed branch: lp:~timkuhlman/ubuntu-geonames/column-size-fiz
Merge into: lp:ubuntu-geonames
Diff against target: 61 lines (+9/-9)
2 files modified
geoname-modpython.py (+1/-1)
import-geonames.sh (+8/-8)
To merge this branch: bzr merge lp:~timkuhlman/ubuntu-geonames/column-size-fiz
Reviewer Review Type Date Requested Status
Evan (community) Approve
Review via email: mp+280785@code.launchpad.net

Description of the change

Updated the DB schema to match the latest data and fixed the geoname-modpython.py syntax errors.

To post a comment you must log in.
Revision history for this message
Evan (ev) wrote :

Wow, how did that ever work?

Looks sensible. +1

review: Approve
Revision history for this message
Evan (ev) wrote :

Have you thought of incorporating Stuart's suggestion, though?

https://bugs.launchpad.net/ubuntu-geonames/+bug/1517255/comments/1

I see no reason to stick to varchar.

Revision history for this message
Tim Kuhlman (timkuhlman) wrote :

> Have you thought of incorporating Stuart's suggestion, though?
>
> https://bugs.launchpad.net/ubuntu-geonames/+bug/1517255/comments/1
>
> I see no reason to stick to varchar.

I looked at that then found http://download.geonames.org/export/dump/readme.txt where it says the size should be 200. I think either will work but figured I would just stick to the recommended size unless there was a reason to diverge. Less to pop up in a diff and wonder about next someone looks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'geoname-modpython.py'
--- geoname-modpython.py 2014-08-14 08:49:43 +0000
+++ geoname-modpython.py 2015-12-17 00:20:05 +0000
@@ -44,7 +44,7 @@
44jsonheader = '['44jsonheader = '['
45jsonfooter = ']'45jsonfooter = ']'
46jsonentry = '{"name" : "%s", "admin1" : "%s", "admin2" : "%s", "country" : "%s", ' \46jsonentry = '{"name" : "%s", "admin1" : "%s", "admin2" : "%s", "country" : "%s", ' \
47 '"longitude" : "%F", "latitude" : "%F" , '"timezone" : "%s" }'47 '"longitude" : "%F", "latitude" : "%F" , "timezone" : "%s" }'
4848
49def handler(req):49def handler(req):
50 fs = util.FieldStorage(req)50 fs = util.FieldStorage(req)
5151
=== modified file 'import-geonames.sh'
--- import-geonames.sh 2014-08-14 08:49:43 +0000
+++ import-geonames.sh 2015-12-17 00:20:05 +0000
@@ -53,7 +53,7 @@
53 fclass char(1),53 fclass char(1),
54 fcode varchar(10),54 fcode varchar(10),
55 country varchar(2),55 country varchar(2),
56 cc2 varchar(60),56 cc2 varchar(200),
57 admin1 varchar(20),57 admin1 varchar(20),
58 admin2 varchar(80),58 admin2 varchar(80),
59 admin3 varchar(20),59 admin3 varchar(20),
@@ -93,12 +93,12 @@
93 tld char(3),93 tld char(3),
94 currency char(3),94 currency char(3),
95 currencyName character varying(20),95 currencyName character varying(20),
96 Phone char(20), 96 Phone char(20),
97 postalCodeFormat char(60), 97 postalCodeFormat char(60),
98 postalCodeRegex char(200), 98 postalCodeRegex char(200),
99 languages character varying(200), 99 languages character varying(200),
100 geonameId int,100 geonameId int,
101 neighbours char(50), 101 neighbours char(50),
102 equivalentFipsCode char(10)102 equivalentFipsCode char(10)
103);103);
104\copy countryInfo${LOAD_POSTFIX} (iso_alpha2,iso_alpha3,iso_numeric,fips_code,name,capital,areaInSqKm,population,continent,tld,currency,currencyName,Phone,postalCodeFormat,postalCodeRegex,languages,geonameId,neighbours,equivalentFipsCode) from $WORKPATH/countryInfo.txt.tmp null as ''104\copy countryInfo${LOAD_POSTFIX} (iso_alpha2,iso_alpha3,iso_numeric,fips_code,name,capital,areaInSqKm,population,continent,tld,currency,currencyName,Phone,postalCodeFormat,postalCodeRegex,languages,geonameId,neighbours,equivalentFipsCode) from $WORKPATH/countryInfo.txt.tmp null as ''
@@ -114,7 +114,7 @@
114114
115DROP TABLE IF EXISTS admin1codes${LOAD_POSTFIX};115DROP TABLE IF EXISTS admin1codes${LOAD_POSTFIX};
116CREATE TABLE admin1codes${LOAD_POSTFIX} (116CREATE TABLE admin1codes${LOAD_POSTFIX} (
117 code varchar(10),117 code varchar(20),
118 name TEXT,118 name TEXT,
119 nameAscii TEXT,119 nameAscii TEXT,
120 geonameid int120 geonameid int
@@ -214,7 +214,7 @@
214ALTER INDEX geoname_admin2codes_code_idx${LOAD_POSTFIX} RENAME TO geoname_admin2codes_code_idx;214ALTER INDEX geoname_admin2codes_code_idx${LOAD_POSTFIX} RENAME TO geoname_admin2codes_code_idx;
215ALTER INDEX geoname_countryinfo_isoalpha2_idx${LOAD_POSTFIX} RENAME TO geoname_countryinfo_isoalpha2_idx;215ALTER INDEX geoname_countryinfo_isoalpha2_idx${LOAD_POSTFIX} RENAME TO geoname_countryinfo_isoalpha2_idx;
216ALTER INDEX geoname_alternatename_idx${LOAD_POSTFIX} RENAME TO geoname_alternatename_idx;216ALTER INDEX geoname_alternatename_idx${LOAD_POSTFIX} RENAME TO geoname_alternatename_idx;
217GRANT ALL PRIVILEGES ON geoname, admin1codes, countryInfo, alternatename TO $PGUSER;217GRANT ALL PRIVILEGES ON geoname, admin1codes, countryInfo, alternatename TO "$PGUSER";
218GRANT SELECT ON geoname, admin1codes, admin2codes, countryInfo, alternatename TO public;218GRANT SELECT ON geoname, admin1codes, admin2codes, countryInfo, alternatename TO public;
219COMMIT;219COMMIT;
220EOT220EOT

Subscribers

People subscribed via source and target branches

to all changes: