def create(silent = False): """ Create the geometry model from the geometry__country_level0 table """ from openspending.core import db from openspending.model.country import Country result = db.engine.execute("SELECT \ country_level0.gid as gid \ FROM public.geometry__country_level0 as country_level0;") for row in result: gid = row['gid'] #check if it already exists and don't overwrite if Country.by_gid(gid): if not silent: log.info("Found existing gid " + str(gid) + ". Will not replace.") continue tempcountry = Country(gid) db.session.add(tempcountry) db.session.commit()
def create(silent=False): """ Create the geometry model from the geometry__country_level0 table """ from openspending.core import db from openspending.model.country import Country result = db.engine.execute("SELECT \ country_level0.gid as gid \ FROM public.geometry__country_level0 as country_level0;" ) for row in result: gid = row['gid'] #check if it already exists and don't overwrite if Country.by_gid(gid): if not silent: log.info("Found existing gid " + str(gid) + ". Will not replace.") continue tempcountry = Country(gid) db.session.add(tempcountry) db.session.commit()
def test_properties_regions(self): tempobj = Country.by_gid(1) assert tempobj.sovereignty == "Netherlands"
def test_properties_regions(self): tempobj = Country.by_gid(1) assert len(tempobj.regions.keys()) == 10 assert tempobj.label == "Aruba"