def upgrade():
    conn = Connection(op.get_bind())

    # https://github.com/clld/wals-data/issues/62
    for gid, (fid, fname) in FAMILIES.items():
        fpk = conn.insert(Family, id=fid, name=fname)
        conn.update(Genus, dict(family_pk=fpk), id=gid)

    conn.update(Genus, dict(name='Bororoan'), id='bororo')
def upgrade():
    conn = Connection(op.get_bind())

    # https://github.com/clld/wals-data/issues/50
    fpk = conn.pk(Family, 'utoaztecan')
    gname = 'California Uto-Aztecan'
    gid = slug(gname)
    gpk = conn.insert(Genus, id=gid, name=gname, icon='fffff00', family_pk=fpk)

    for oid in ['takic', 'tubatulabal']:
        opk = conn.pk(Genus, oid)
        conn.update(WalsLanguage, dict(genus_pk=gpk), genus_pk=opk)
        conn.insert(Config, key=Config.replacement_key(Genus, oid), value=gid)
        conn.delete(Genus, id=oid)

    # https://github.com/clld/wals-data/issues/49
    conn.update_name('aym', 'Aymara (Central)')
    conn.update_glottocode('aym', 'cent2142')
    conn.update_iso('aym', 'ayr', ayc='Southern Aymara')

    # https://github.com/clld/wals-data/issues/48
    # The genus Guaymi should be renamed Guaymiic.
    conn.update(Genus, dict(name='Guaymiic'), id='guaymi')

    # The genus Aruak should be renamed Arhuacic.
    conn.update(Genus, dict(name='Arhuacic'), id='aruak')

    # The language Motilón should be renamed Barí (while keeping Motilón as the name of
    # the genus).
    conn.update_name('mti', 'Barí')

    # The genus Chibchan Proper should be split into two genera, Chibcha-Duit, containing
    # the language Muisca, and Tunebo, containing the language Tunebo.
    conn.update_genus(
        'msc', ('chibchaduit', 'Chibcha-Duit', 'fffff00'), family='chibchan')
    conn.update_genus(
        'tnb', ('tunebo', 'Tunebo', 'fffcc00'), family='chibchan')
    conn.insert(
        Config, key=Config.replacement_key(Genus, 'chibchanproper'), value=Config.gone)
    conn.delete(Genus, id='chibchanproper')

    # https://github.com/clld/wals-data/issues/44
    conn.update_name('jlu', 'Luwo', other='Jur Luwo')

    # https://github.com/clld/wals-data/issues/43
    conn.update_genus('ctw', ('catawban', 'Catawban', 'fffcc00'), family='siouan')
    conn.update(Genus, dict(name='Core Siouan'), id='siouan')

    # https://github.com/clld/wals-data/issues/40
    conn.update_source('Sumbuk-2002', year='1999', name='Sumbuk 1999')
Beispiel #3
0
def upgrade():
    conn = Connection(op.get_bind())

    for fname, genera in DATA.items():
        fpk = conn.insert(Family, id=slug(fname), name=fname)

        for gspec, lnames in genera.items():
            if isinstance(gspec, tuple):
                if len(gspec) == 3:
                    # new genus
                    gpk = conn.insert(
                        Genus, id=gspec[0], name=gspec[1], icon=gspec[2], family_pk=fpk)
                elif len(gspec) == 2:
                    # rename genus
                    gpk = conn.pk(Genus, gspec[0])
                    conn.update(Genus, dict(family_pk=fpk, name=gspec[1]), pk=gpk)
                else:
                    raise ValueError()
            else:
                # just update the family
                gpk = conn.pk(Genus, gspec)
                conn.update(Genus, dict(family_pk=fpk), pk=gpk)

            for lname in lnames:
                lpk = conn.pk(Language, lname, attr='name')
                conn.update(WalsLanguage, dict(genus_pk=gpk), pk=lpk)

    for gid in GONE:
        conn.insert(Config, key=Config.replacement_key(Genus, gid), value=Config.gone)
        conn.delete(Genus, id=gid)

    conn.insert(
        Config, key=Config.replacement_key(Family, 'australian'), value=Config.gone)
    conn.delete(Family, id='australian')

    conn.update_name('mdl', 'Matngele')
def upgrade():
    conn = Connection(op.get_bind())

    # https://github.com/clld/wals-data/issues/58
    conn.update_glottocode("uhi", "atam1239")

    # https://github.com/clld/wals-data/issues/57
    conn.update_glottocode("mdm", "west2443")
    conn.update_glottocode("wem", "west2443")

    # https://github.com/clld/wals-data/issues/56
    conn.update_glottocode("wdo", "pitj1243")

    # https://github.com/clld/wals-data/issues/55
    conn.update_glottocode("wir", "wira1265")

    # https://github.com/clld/wals-data/issues/51
    lpk = conn.pk(common.Language, "gno")
    ipk = conn.insert(common.Identifier, name="Kotiria", description="other", type="name")
    conn.insert(common.LanguageIdentifier, identifier_pk=ipk, language_pk=lpk)
Beispiel #5
0
    def test_migration(self):
        from wals3.migration import Connection

        conn = Connection(DBSession)
        conn.insert(Language, id='zzz')
        conn.update_iso('zzz', 'deu', eng='English')
        conn.update_iso('zzz', 'eng', deu='German')
        conn.update_genus('zzz', ('genus', u'Genus'), ('family', u'Family'))
        conn.update_genus('zzz', ('othergenus', u'Other Genus'), 'family')
        conn.update_genus('zzz', 'genus')
Beispiel #6
0
def upgrade():
    conn = Connection(op.get_bind())

    # The genus for Yanesha’ needs to be renamed Yanesha’.
    conn.update(Genus, dict(name="Yanesha'"), id='westernarawakan')

    # Bahuana
    conn.update_name('bah', 'Xiriana')
    conn.update_glottocode('bah', 'xiri1243')
    conn.update_iso('bah', xir='Xiriâna')
    coords = Coordinates('2d40N', '62d30W')
    conn.update(
        Language, dict(latitude=coords.latitude, longitude=coords.longitude), id='bah')

    spk = conn.execute('select max(pk) from source').fetchone()[0] + 1
    lpk = conn.pk(Language, 'bah')
    spk = conn.insert(
        Source,
        pk=spk,
        id='Ramirez-1992',
        name='Ramirez 1992',
        description='Bahuana: une nouvelle langue de la famille Arawak',
        bibtex_type=EntryType.book,
        author='Ramirez, Henri',
        year='1992',
        title='Bahuana: une nouvelle langue de la famille Arawak',
        address='Paris',
        publisher='Amerindia')
    conn.insert(LanguageSource, language_pk=lpk, source_pk=spk)
    vspk = conn.pk(ValueSet, lpk, attr='language_pk')
    conn.insert(ValueSetReference, valueset_pk=vspk, source_pk=spk, description='35')

    # split northern arawakan
    GENERA = {
        'Alto-Orinoco': 'bnw mpr'.split(),
        'Caribbean Arawakan': 'ara grf goa'.split(),
        'Inland Northern Arawakan': 'acg bae cur ppc res tar wrk ycn'.split(),
        'Bahuanic': ['bah'],
        'Wapishanan': ['wps'],
    }
    ICONS = ['cdd0000', 'cffcc00', 'cffff00', 'cff6600', 'cffffcc']

    fpk = conn.pk(Family, 'arawakan')
    for icon, (name, lids) in zip(ICONS, GENERA.items()):
        gpk = conn.insert(Genus, id=slug(name), name=name, icon=icon, family_pk=fpk)
        for lid in lids:
            conn.update_genus(lid, gpk)

    conn.insert(
        Config,
        key=Config.replacement_key(Genus, 'northernarawakan'),
        value=Config.gone)
    conn.delete(Genus, id='northernarawakan')
Beispiel #7
0
    def test_migration(self):
        from wals3.migration import Connection

        conn = Connection(DBSession)
        conn.insert(Language, id="zzz")
        conn.update_iso("zzz", "deu", eng="English")
        conn.update_iso("zzz", "eng", deu="German")
        conn.update_genus("zzz", ("genus", u"Genus", ""), ("family", u"Family"))
        conn.update_genus("zzz", ("othergenus", u"Other Genus", ""), "family")
        conn.update_genus("zzz", "genus")
Beispiel #8
0
def test_migration(db):
    from wals3.migration import Connection

    conn = Connection(DBSession)
    conn.insert(Language, id='zzz')
    conn.update_iso('zzz', 'deu', eng='English')
    conn.update_iso('zzz', 'eng', deu='German')
    conn.update_genus('zzz', ('genus', u'Genus', ''), ('family', u'Family'))
    conn.update_genus('zzz', ('othergenus', u'Other Genus', ''), 'family')
    conn.update_genus('zzz', 'genus')
Beispiel #9
0
def upgrade():
    conn = Connection(op.get_bind())
    # https://github.com/clld/wals-data/issues/64
    conn.update_name('bnr', 'Bilinarra')
    conn.update_source(
        'Nordlinger-1990',
        description='A Sketch Grammar of Bilinarra',
        title='A Sketch Grammar of Bilinarra')

    # https://github.com/clld/wals-data/issues/63
    conn.update_name('jva', 'Karajá')
    conn.update_name('ghr', 'Bunan')

    # https://github.com/clld/wals-data/issues/59
    conn.update_genus('lrd', 'tangkic')

    # https://github.com/clld/wals-data/issues/54
    conn.update_source(
        'Schauer-and-Schauer-1958',
        name='Schauer and Schauer 1978',
        year='1978',
        year_int=1978)

    # https://github.com/clld/wals-data/issues/53
    conn.update_genus(
        'ocu', ('matlatzincan', 'Matlatzincan', 't9999ff'), family='otomanguean')

    # https://github.com/clld/wals-data/issues/47
    conn.update_name('bno', 'Waimaha')

    # https://github.com/clld/wals-data/issues/46
    conn.update_source(
        'Troike-1996',
        booktitle='Handbook of North American Indians. Volume 17: Languages')

    # https://github.com/clld/wals-data/issues/42
    conn.update_name('cos', 'Rumsien')
Beispiel #10
0
def upgrade():
    conn = Connection(op.get_bind())

    # https://github.com/clld/wals-data/issues/50
    fpk = conn.pk(Family, 'utoaztecan')
    gname = 'California Uto-Aztecan'
    gid = slug(gname)
    gpk = conn.insert(Genus, id=gid, name=gname, icon='fffff00', family_pk=fpk)

    for oid in ['takic', 'tubatulabal']:
        opk = conn.pk(Genus, oid)
        conn.update(WalsLanguage, dict(genus_pk=gpk), genus_pk=opk)
        conn.insert(Config, key=Config.replacement_key(Genus, oid), value=gid)
        conn.delete(Genus, id=oid)

    # https://github.com/clld/wals-data/issues/49
    conn.update_name('aym', 'Aymara (Central)')
    conn.update_glottocode('aym', 'cent2142')
    conn.update_iso('aym', 'ayr', ayc='Southern Aymara')

    # https://github.com/clld/wals-data/issues/48
    # The genus Guaymi should be renamed Guaymiic.
    conn.update(Genus, dict(name='Guaymiic'), id='guaymi')

    # The genus Aruak should be renamed Arhuacic.
    conn.update(Genus, dict(name='Arhuacic'), id='aruak')

    # The language Motilón should be renamed Barí (while keeping Motilón as the name of
    # the genus).
    conn.update_name('mti', 'Barí')

    # The genus Chibchan Proper should be split into two genera, Chibcha-Duit, containing
    # the language Muisca, and Tunebo, containing the language Tunebo.
    conn.update_genus('msc', ('chibchaduit', 'Chibcha-Duit', 'fffff00'),
                      family='chibchan')
    conn.update_genus('tnb', ('tunebo', 'Tunebo', 'fffcc00'),
                      family='chibchan')
    conn.insert(Config,
                key=Config.replacement_key(Genus, 'chibchanproper'),
                value=Config.gone)
    conn.delete(Genus, id='chibchanproper')

    # https://github.com/clld/wals-data/issues/44
    conn.update_name('jlu', 'Luwo', other='Jur Luwo')

    # https://github.com/clld/wals-data/issues/43
    conn.update_genus('ctw', ('catawban', 'Catawban', 'fffcc00'),
                      family='siouan')
    conn.update(Genus, dict(name='Core Siouan'), id='siouan')

    # https://github.com/clld/wals-data/issues/40
    conn.update_source('Sumbuk-2002', year='1999', name='Sumbuk 1999')