Esempio n. 1
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 4
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)