make_orphan_backend_starter __author__ = 'kpaskov' if __name__ == "__main__": nex_session_maker = prepare_schema_connection(nex, config.NEX_DBTYPE, 'sgd-master-db.stanford.edu:1521', config.NEX_DBNAME, config.NEX_SCHEMA, config.NEX_DBUSER, config.NEX_DBPASS) perf_session_maker = prepare_schema_connection(perf, config.PERF_DBTYPE, 'sgd-db1.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS) nex_backend = SGDBackend(config.NEX_DBTYPE, 'sgd-master-db.stanford.edu:1521', config.NEX_DBNAME, config.NEX_SCHEMA, config.NEX_DBUSER, config.NEX_DBPASS, None) # ------------------------------------------ Perf ------------------------------------------ # ------------------------------------------ Disambig ------------------------------------------ do_conversion(make_backend_starter(nex_backend, 'all_disambigs', 1000), [Json2DisambigPerfDB(perf_session_maker, commit_interval=1000)]) # ------------------------------------------ Evelements ------------------------------------------ from src.sgd.model.perf.core import Strain as PerfStrain do_conversion(make_backend_starter(nex_backend, 'all_strains', 1000), [Json2CorePerfDB(perf_session_maker, PerfStrain, name='convert.from_backend.strain', commit_interval=1000, delete_untouched=True)]) # ------------------------------------------ Bioentity ------------------------------------------ from src.sgd.model.perf.core import Bioentity as PerfBioentity, Locustab as PerfLocustab, Locusentry as PerfLocusentry, Tag as PerfTag do_conversion(make_backend_starter(nex_backend, 'all_bioentities', 1000), [Json2CorePerfDB(perf_session_maker, PerfBioentity, name='convert.from_backend.bioentity', commit_interval=1000, delete_untouched=True)]) do_conversion(make_backend_starter(nex_backend, 'all_locustabs', 1000), [Json2CorePerfDB(perf_session_maker, PerfLocustab, name='convert.from_backend.all_locustabs', commit_interval=1000, delete_untouched=True)])
nex_backend = SGDBackend(config.NEX_DBTYPE, 'sgd-master-db.stanford.edu:1521', config.NEX_DBNAME, config.NEX_SCHEMA, config.NEX_DBUSER, config.NEX_DBPASS, None) from src.sgd.model.nex.bioitem import Reservedname from src.sgd.model.nex.paragraph import Paragraph, Bioentityparagraph, ParagraphReference from src.sgd.convert.from_bud.paragraph import make_bioentity_paragraph_starter, make_paragraph_reference_starter do_conversion(make_bioentity_paragraph_starter(bud_session_maker, nex_session_maker), [Json2Obj(Bioentityparagraph), Obj2NexDB(nex_session_maker, lambda x: x.query(Bioentityparagraph), name='convert.from_bud.paragraph.bioentity', delete_untouched=True, commit=True, already_deleted=clean_up_orphans(nex_session_maker, Bioentityparagraph, Paragraph, 'BIOENTITY'))]) do_conversion(make_paragraph_reference_starter(nex_session_maker), [Json2Obj(ParagraphReference), Obj2NexDB(nex_session_maker, lambda x: x.query(ParagraphReference), name='convert.from_bud.paragraph_reference', delete_untouched=True, commit=True)]) from src.sgd.model.perf.core import Bioentity as PerfBioentity do_conversion(make_backend_starter(nex_backend, 'all_bioentities', 1000), [Json2CorePerfDB(perf_session_maker, PerfBioentity, name='convert.from_backend.bioentity', commit_interval=1000, delete_untouched=True)]) perf_session_maker = prepare_schema_connection(perf, config.PERF_DBTYPE, 'sgd-db2.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS) perf_backend = PerfBackend(config.PERF_DBTYPE, 'sgd-db1.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS, None) do_conversion(make_backend_starter(perf_backend, 'all_bioentities', 1000), [Json2CorePerfDB(perf_session_maker, PerfBioentity, name='convert.from_backend.bioentity', commit_interval=1000, delete_untouched=True)])
# ------------------------------------------ Paragraph ------------------------------------------ from src.sgd.model.nex.paragraph import Paragraph, Strainparagraph, ParagraphReference from src.sgd.convert.from_bud.paragraph import make_strain_paragraph_starter, make_paragraph_reference_starter do_conversion(make_strain_paragraph_starter(nex_session_maker), [Json2Obj(Strainparagraph), Obj2NexDB(nex_session_maker, lambda x: x.query(Strainparagraph), name='convert.from_bud.paragraph.strain', delete_untouched=True, commit=True, already_deleted=clean_up_orphans(nex_session_maker, Strainparagraph, Paragraph, 'STRAIN'))]) # do_conversion(make_paragraph_reference_starter(nex_session_maker), # [Json2Obj(ParagraphReference), # Obj2NexDB(nex_session_maker, lambda x: x.query(ParagraphReference), # name='convert.from_bud.paragraph_reference', # delete_untouched=True, # commit=True)]) # ------------------------------------------ Perf ------------------------------------------ from src.sgd.model.perf.core import Strain as PerfStrain do_conversion(make_backend_starter(nex_backend, 'all_strains', 1000), [Json2CorePerfDB(perf_session_maker, PerfStrain, name='convert.from_backend.strain', commit_interval=1000, delete_untouched=True)]) # ------------------------------------------ Perf2 ------------------------------------------ perf_session_maker = prepare_schema_connection(perf, config.PERF_DBTYPE, 'sgd-db2.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS) perf_backend = PerfBackend(config.PERF_DBTYPE, 'sgd-db1.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS, None) do_conversion(make_backend_starter(perf_backend, 'all_strains', 1000), [Json2CorePerfDB(perf_session_maker, PerfStrain, name='convert.from_backend.strain', commit_interval=1000, delete_untouched=True)])
__author__ = 'kpaskov' if __name__ == "__main__": nex_session_maker = prepare_schema_connection(nex, config.NEX_DBTYPE, 'sgd-master-db.stanford.edu:1521', config.NEX_DBNAME, config.NEX_SCHEMA, config.NEX_DBUSER, config.NEX_DBPASS) perf_session_maker = prepare_schema_connection(perf, config.PERF_DBTYPE, 'sgd-db1.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS) nex_backend = SGDBackend(config.NEX_DBTYPE, 'sgd-master-db.stanford.edu:1521', config.NEX_DBNAME, config.NEX_SCHEMA, config.NEX_DBUSER, config.NEX_DBPASS, None) # ------------------------------------------ Perf ------------------------------------------ # ------------------------------------------ Reference ------------------------------------------ from src.sgd.model.perf.core import Reference as PerfReference, Author as PerfAuthor, Bibentry as PerfBibentry do_conversion(make_backend_starter(nex_backend, 'all_references', 1000), [Json2CorePerfDB(perf_session_maker, PerfReference, name='convert.from_backend.reference', delete_untouched=True, commit_interval=1000)]) do_conversion(make_backend_starter(nex_backend, 'all_authors', 1000), [Json2CorePerfDB(perf_session_maker, PerfAuthor, name='convert.from_backend.author', delete_untouched=True, commit_interval=1000)]) do_conversion(make_backend_starter(nex_backend, 'all_bibentries', 1000), [Json2CorePerfDB(perf_session_maker, PerfBibentry, name='convert.from_backend.all_bibentries', commit_interval=1000, delete_untouched=True)]) do_conversion(make_orphan_backend_starter(nex_backend, ['references_this_week']), [Json2OrphanPerfDB(perf_session_maker, name='convert.from_backend.orphans', commit_interval=1000)]) # ------------------------------------------ Perf2 ------------------------------------------ perf_session_maker = prepare_schema_connection(perf, config.PERF_DBTYPE, 'sgd-db2.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS) perf_backend = PerfBackend(config.PERF_DBTYPE, 'sgd-db1.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS, None)
nex_session = nex_session_maker() locus_ids = [x.id for x in nex_session.query(Locus).all()] contig_ids = [x.id for x in nex_session.query(Contig).all()] nex_session.close() do_conversion(make_locus_data_backend_starter(nex_backend, 'neighbor_sequence_details', locus_ids), [Json2DataPerfDB(perf_session_maker, BioentityDetails, 'NEIGHBOR_SEQUENCE', locus_ids, name='convert.from_backend.neighbor_sequence_details', commit_interval=1000)]) do_conversion(make_locus_data_backend_starter(nex_backend, 'sequence_details', locus_ids), [Json2DataPerfDB(perf_session_maker, BioentityDetails, 'SEQUENCE', locus_ids, name='convert.from_backend.sequence_details', commit_interval=1000)]) do_conversion(make_contig_data_backend_starter(nex_backend, 'sequence_details', contig_ids), [Json2DataPerfDB(perf_session_maker, BioitemDetails, 'SEQUENCE', contig_ids, name='convert.from_backend.sequence_details', commit_interval=1000)]) do_conversion(make_backend_starter(nex_backend, 'all_bioitems', 1000), [Json2CorePerfDB(perf_session_maker, PerfBioitem, name='convert.from_backend.bioitem', commit_interval=1000, delete_untouched=True)]) # do_conversion(make_backend_starter(nex_backend, 'all_strains', 1000), # [Json2CorePerfDB(perf_session_maker, PerfStrain, name='convert.from_backend.strain', commit_interval=1000, delete_untouched=True)]) # ------------------------------------------ Perf2 ------------------------------------------ perf_session_maker = prepare_schema_connection(perf, config.PERF_DBTYPE, 'sgd-db2.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS) perf_backend = PerfBackend(config.PERF_DBTYPE, 'sgd-db1.stanford.edu:1521', config.PERF_DBNAME, config.PERF_SCHEMA, config.PERF_DBUSER, config.PERF_DBPASS, None) # do_conversion(make_locus_data_backend_starter(perf_backend, 'neighbor_sequence_details', locus_ids), # [Json2DataPerfDB(perf_session_maker, BioentityDetails, 'NEIGHBOR_SEQUENCE', locus_ids, name='convert.from_backend.neighbor_sequence_details', commit_interval=1000)]) # # do_conversion(make_locus_data_backend_starter(perf_backend, 'sequence_details', locus_ids), # [Json2DataPerfDB(perf_session_maker, BioentityDetails, 'SEQUENCE', locus_ids, name='convert.from_backend.sequence_details', commit_interval=1000)]) #