Пример #1
0
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()
Пример #2
0
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()
Пример #3
0
 def test_properties_regions(self):
     tempobj = Country.by_gid(1)
     assert tempobj.sovereignty == "Netherlands"
Пример #4
0
 def test_properties_regions(self):
     tempobj = Country.by_gid(1)
     assert len(tempobj.regions.keys()) == 10
     assert tempobj.label == "Aruba"
Пример #5
0
 def test_properties_regions(self):
     tempobj = Country.by_gid(1)
     assert tempobj.sovereignty == "Netherlands"
Пример #6
0
 def test_properties_regions(self):
     tempobj = Country.by_gid(1)
     assert len(tempobj.regions.keys()) == 10
     assert tempobj.label == "Aruba"