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')
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()) # 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')
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')
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')
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()) 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')