def import_old_contracts(filepath):
    '''
    Takes a csv of old contracts and imports them into the DB
    '''
    from purchasing.data.importer.old_contracts import main
    print 'Importing data from {filepath}\n'.format(filepath=filepath)
    main(filepath)
    print 'Import finished!'
    return
def import_old_contracts(filepath):
    '''
    Takes a csv of old contracts and imports them into the DB
    '''
    from purchasing.data.importer.old_contracts import main
    print 'Importing data from {filepath}\n'.format(filepath=filepath)
    main(filepath)
    print 'Import finished!'
    return
def scrape(_all):
    print 'Disabling triggers...'
    turn_off_sqlalchemy_events()
    from purchasing.data.importer.scrape_county import main
    print 'Scraping County'
    main(_all)
    print 'Scraping Finished'
    print 'Enabling triggers...'
    turn_on_sqlalchemy_events()
    return
Beispiel #4
0
def import_nigp(filepath, replace=False):
    if replace:
        print 'Deleting current categories...'
        db.session.execute('DELETE FROM category')
        db.session.commit
    from purchasing.data.importer.nigp import main
    print 'Importing data from {filepath}\n'.format(filepath=filepath)
    main(filepath)
    print 'Import finished!'
    return
def import_nigp(filepath, replace=False):
    if replace:
        print "Deleting current categories..."
        db.session.execute("DELETE FROM category")
        db.session.commit
    from purchasing.data.importer.nigp import main

    print "Importing data from {filepath}\n".format(filepath=filepath)
    main(filepath)
    print "Import finished!"
    return
def import_costars(user=None, secret=None, bucket=None, directory=None):
    '''
    Takes a directory which contains a number of csv files with the
    costars data, and then important them into the DB
    '''
    from purchasing.data.importer.costars import main
    for file in os.listdir(directory):
        if file.endswith('.csv'):
            print 'Importing data from {file}'.format(file=file)
            main(os.path.join(directory, file), file, user, secret, bucket)
    print 'Import finished!'
    return
def import_state(filepath):
    '''
    Takes a csv of state contracts and imports them into the DB
    '''
    from purchasing.data.importer.state import main
    print 'Importing data from {filepath}\n'.format(filepath=filepath)
    main(filepath)
    print 'Import finished!'
    print 'Refreshing search_view...'
    refresh_search_view()
    print 'Done!'
    return
def import_costars(user=None, secret=None, bucket=None, directory=None):
    '''
    Takes a directory which contains a number of csv files with the
    costars data, and then important them into the DB
    '''
    from purchasing.data.importer.costars import main
    for file in os.listdir(directory):
        if file.endswith('.csv'):
            print 'Importing data from {file}'.format(file=file)
            main(os.path.join(directory, file), file, user, secret, bucket)
    print 'Import finished!'
    return
def import_old_contracts(filepath):
    """
    Takes a csv of old contracts and imports them into the DB
    """
    print "Disabling triggers..."
    turn_off_sqlalchemy_events()
    from purchasing.data.importer.old_contracts import main

    print "Importing data from {filepath}\n".format(filepath=filepath)
    main(filepath)
    print "Import finished!"
    print "Enabling triggers..."
    turn_on_sqlalchemy_events()
    print "Refreshing search_view..."
    print "Done!"
    return
    def test_old_contracts_import(self):
        main(current_app.config.get('PROJECT_ROOT') + '/purchasing_test/mock/old_contracts.csv')

        # assert we get all contracts and companies
        contracts = ContractBase.query.all()
        self.assertEquals(len(contracts), 3)

        companies = Company.query.all()
        self.assertEquals(len(companies), 3)

        controller_nums = ['49020', '49011', '49189']

        for contract in contracts:
            self.assertTrue(contract.financial_id in controller_nums)
            controller_nums.remove(contract.financial_id)

        self.assertEquals(len(controller_nums), 0)
def import_costars(user=None, secret=None, bucket=None, directory=None):
    """
    Takes a directory which contains a number of csv files with the
    costars data, and then important them into the DB
    """
    print "Disabling triggers..."
    turn_off_sqlalchemy_events()
    from purchasing.data.importer.costars import main

    for file in os.listdir(directory):
        if file.endswith(".csv"):
            print "Importing data from {file}".format(file=file)
            main(os.path.join(directory, file), file, user, secret, bucket)
    print "Import finished!"
    print "Enabling triggers..."
    turn_on_sqlalchemy_events()
    return
Beispiel #12
0
    def test_old_contracts_import(self):
        main(
            current_app.config.get('PROJECT_ROOT') +
            '/purchasing_test/mock/old_contracts.csv')

        # assert we get all contracts and companies
        contracts = get_all_contracts()
        self.assertEquals(len(contracts), 3)

        companies = get_all_companies()
        self.assertEquals(len(companies), 3)

        controller_nums = [49020, 49011, 49189]

        for contract in contracts:
            self.assertTrue(contract.financial_id in controller_nums)
            controller_nums.remove(contract.financial_id)

        self.assertEquals(len(controller_nums), 0)
def import_nigp(filepath):
    from purchasing.data.importer.nigp import main
    print 'Importing data from {filepath}\n'.format(filepath=filepath)
    main(filepath)
    print 'Import finished!'
    return
def scrape(_all):
    from purchasing.data.importer.scrape_county import main
    print 'Scraping County'
    main(_all)
    print 'Scraping Finished'
    return
def scrape(_all):
    from purchasing.data.importer.scrape_county import main
    print 'Scraping County'
    main(_all)
    print 'Scraping Finished'
    return
def import_nigp(filepath):
    from purchasing.data.importer.nigp import main
    print 'Importing data from {filepath}\n'.format(filepath=filepath)
    main(filepath)
    print 'Import finished!'
    return