Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.pyc
*.sublime-project
*.sublime-workspace
.idea
.cache
.coverage
.coveralls.yml
Expand All @@ -15,3 +16,4 @@
build/
dist/
MANIFEST

6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ matrix:
- python: 3.5
env: TOX_ENV=lint

addons:
postgresql: 11
apt:
packages:
- postgresql-11-postgis-2.5

install:
- pip install tox

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
install_requires=[
'GeoAlchemy2',
'ipdb',
'progressbar2',
'progressbar33',
'psycopg2',
'requests',
'SQLAlchemy',
Expand Down
20 changes: 6 additions & 14 deletions sqlalchemy_geonames/bin/sqlageonames.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import argparse
import os
import sys
from copy import deepcopy
from zipfile import ZipFile
import requests
from progressbar import ProgressBar, ETA, FileTransferSpeed, Percentage, Bar
Expand Down Expand Up @@ -56,19 +55,12 @@ def get_local_filepath(filename, download_dir=DEFAULT_DOWNLOAD_DIR):


def get_download_config(primary_filename, language_code=DEFAULT_LANGUAGE_CODE):
download_config = {k: v for k, v in deepcopy(filename_config).items()
if k in supported_filenames}
for filename, opts in download_config.items():
# Only download the selected primary primary_filename file
if (
filename in PRIMARY_GEONAME_FILENAMES and
filename != primary_filename
):
del download_config[filename]
# If a file is bound to a specific language code and is not the
# specified one then remove it.
if 'language_code' in opts and opts['language_code'] != language_code:
del download_config[filename]
download_config = {}
for filename, opts in filename_config.items():
if filename in supported_filenames and not (
(filename in PRIMARY_GEONAME_FILENAMES and filename != primary_filename) or 'language_code' in opts and
opts['language_code'] != language_code):
download_config[filename] = opts
return download_config


Expand Down
4 changes: 2 additions & 2 deletions sqlalchemy_geonames/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class Geoname(GeonameBase):
country = relationship(GeonameCountry)

# alternate country codes, comma separated, ISO-3166 2-letter country
# code, 60 characters
cc2 = Column(String(60), nullable=False)
# code, 200 characters
cc2 = Column(String(200), nullable=False)

# fipscode (subject to change to iso code), see exceptions below, see
# file admin1Codes.txt for display names of this code; varchar(20)
Expand Down