예제 #1
0
파일: imdb.py 프로젝트: kannibalox/tranny
def load_sql(download=True):
    """ Load the datasets into the database, optionally downloading the dataset before

    :param download: Download a fresh dataset?
    :type download: bool
    :return: Load status
    :rtype: bool
    """
    tmp_dir = join(config.config_path, 'imdb_temp')
    util.mkdirp(tmp_dir)
    if not download or fetch_database(tmp_dir):
        args = ['imdbpy2sql.py', '-d', tmp_dir, '-u', config.get_db_uri()]
        if 'sqlite' in config.get_db_uri():
            # SQLite is laughably slow without this flag making, Using it
            # makes it possibly the fasted to import
            args.append('--sqlite-transactions')
        log.debug("Executing: {}".format(" ".join(args)))
        ret_val = check_call(args)
        log.debug(ret_val)
예제 #2
0
def load_sql(download=True):
    """ Load the datasets into the database, optionally downloading the dataset before

    :param download: Download a fresh dataset?
    :type download: bool
    :return: Load status
    :rtype: bool
    """
    tmp_dir = join(config.config_path, 'imdb_temp')
    util.mkdirp(tmp_dir)
    if not download or fetch_database(tmp_dir):
        args = ['imdbpy2sql.py', '-d', tmp_dir, '-u', config.get_db_uri()]
        if 'sqlite' in config.get_db_uri():
            # SQLite is laughably slow without this flag making, Using it
            # makes it possibly the fasted to import
            args.append('--sqlite-transactions')
        log.debug("Executing: {}".format(" ".join(args)))
        ret_val = check_call(args)
        log.debug(ret_val)
예제 #3
0
    def cmd_geoip(options):
        from tranny.service import geoip
        from tranny.app import Session
        from tranny.app import config

        engine = create_engine(config.get_db_uri())
        Session.configure(bind=engine)
        Base.metadata.create_all(bind=engine)

        db_file_path = geoip.fetch_update(download=options.nodownload)
        geoip.update(Session(), db_file_path)
예제 #4
0
파일: __init__.py 프로젝트: bobbintb/tranny
    def cmd_geoip(options):
        from tranny.service import geoip
        from tranny.app import Session
        from tranny.app import config

        engine = create_engine(config.get_db_uri())
        Session.configure(bind=engine)
        Base.metadata.create_all(bind=engine)

        db_file_path = geoip.fetch_update(download=options.nodownload)
        geoip.update(Session(), db_file_path)