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
1=== modified file 'geoname-modpython.py'
2--- geoname-modpython.py 2014-08-14 08:49:43 +0000
3+++ geoname-modpython.py 2015-12-17 00:20:05 +0000
4@@ -44,7 +44,7 @@
5 jsonheader = '['
6 jsonfooter = ']'
7 jsonentry = '{"name" : "%s", "admin1" : "%s", "admin2" : "%s", "country" : "%s", ' \
8- '"longitude" : "%F", "latitude" : "%F" , '"timezone" : "%s" }'
9+ '"longitude" : "%F", "latitude" : "%F" , "timezone" : "%s" }'
10
11 def handler(req):
12 fs = util.FieldStorage(req)
13
14=== modified file 'import-geonames.sh'
15--- import-geonames.sh 2014-08-14 08:49:43 +0000
16+++ import-geonames.sh 2015-12-17 00:20:05 +0000
17@@ -53,7 +53,7 @@
18 fclass char(1),
19 fcode varchar(10),
20 country varchar(2),
21- cc2 varchar(60),
22+ cc2 varchar(200),
23 admin1 varchar(20),
24 admin2 varchar(80),
25 admin3 varchar(20),
26@@ -93,12 +93,12 @@
27 tld char(3),
28 currency char(3),
29 currencyName character varying(20),
30- Phone char(20),
31- postalCodeFormat char(60),
32- postalCodeRegex char(200),
33- languages character varying(200),
34+ Phone char(20),
35+ postalCodeFormat char(60),
36+ postalCodeRegex char(200),
37+ languages character varying(200),
38 geonameId int,
39- neighbours char(50),
40+ neighbours char(50),
41 equivalentFipsCode char(10)
42 );
43 \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 ''
44@@ -114,7 +114,7 @@
45
46 DROP TABLE IF EXISTS admin1codes${LOAD_POSTFIX};
47 CREATE TABLE admin1codes${LOAD_POSTFIX} (
48- code varchar(10),
49+ code varchar(20),
50 name TEXT,
51 nameAscii TEXT,
52 geonameid int
53@@ -214,7 +214,7 @@
54 ALTER INDEX geoname_admin2codes_code_idx${LOAD_POSTFIX} RENAME TO geoname_admin2codes_code_idx;
55 ALTER INDEX geoname_countryinfo_isoalpha2_idx${LOAD_POSTFIX} RENAME TO geoname_countryinfo_isoalpha2_idx;
56 ALTER INDEX geoname_alternatename_idx${LOAD_POSTFIX} RENAME TO geoname_alternatename_idx;
57-GRANT ALL PRIVILEGES ON geoname, admin1codes, countryInfo, alternatename TO $PGUSER;
58+GRANT ALL PRIVILEGES ON geoname, admin1codes, countryInfo, alternatename TO "$PGUSER";
59 GRANT SELECT ON geoname, admin1codes, admin2codes, countryInfo, alternatename TO public;
60 COMMIT;
61 EOT

Subscribers

People subscribed via source and target branches

to all changes: