コード例 #1
0
ファイル: tests.py プロジェクト: onary/bigdata
 def test_parse(self):
     db.drop_table(DB)
     db.create_index(DB)
     parser.parse("test", True)
     prod = list(DB.products.find())
     self.assertEqual(len(prod), 1)
     self.assertEqual(prod[0]['uid'], '400000022199')
コード例 #2
0
def refresh_db():
    ip_list = db.get_iplist()
    verified_iplist = verifyip_multithread(ip_list)
    #delete table
    db.drop_table()
    #insert table
    data_persistence(verified_iplist)
コード例 #3
0
def create_cam_table():
    """
    The C{cam} table defines a mapping between camera names and C{cam_id}s.
    """
    drop_table("image")
    create_table("cam",
                 [id_field("id", "TINYINT"), "name CHAR(3) NOT NULL UNIQUE"])
コード例 #4
0
ファイル: schema.py プロジェクト: california43/gattini
def create_cam_table():
    """
    The C{cam} table defines a mapping between camera names and C{cam_id}s.
    """
    drop_table("image")
    create_table("cam",
                 [id_field("id", "TINYINT"),
                  "name CHAR(3) NOT NULL UNIQUE"])
コード例 #5
0
ファイル: schema.py プロジェクト: california43/gattini
def create_star_table():
    """
    The C{star} table keeps track of the catalogue stars which are identified by
    AptPhot.
    """
    drop_table("phot")
    create_table("star", 
                 [id_field("star_id", "INT"),
                  int_field("cat_id", True),
                  float_field("ra"),
                  float_field("decl")])
コード例 #6
0
    def _db(args_):
        action = args_.action.lower().strip()
        action_args = (args_.db_login, args_.db_pwd, args_.db_host,
                       args_.db_name)

        if action == "create":
            create_table(*action_args)
        elif action == "drop":
            drop_table(*action_args)
        else:
            raise ValueError("Unknown db action!")
コード例 #7
0
def create_star_table():
    """
    The C{star} table keeps track of the catalogue stars which are identified by
    AptPhot.
    """
    drop_table("phot")
    create_table("star", [
        id_field("star_id", "INT"),
        int_field("cat_id", True),
        float_field("ra"),
        float_field("decl")
    ])
コード例 #8
0
ファイル: main.py プロジェクト: rzaaeeff/Data-Set-Creator
        except IndexError:
            pass

        letters.append(Letter(author, letter, image, drawn_in_free_mode))

    if len(rows) == 0:
        # indicate empty db
        print(database + ' is empty!')
    conn.close()


# creating or opening output db file
os.makedirs(DB_OUTPUT_FOLDER, exist_ok=True)

conn = db.create_connection(DB_RESULT)
db.drop_table(conn)
db.create_table(conn)
db.insert_all_letters(conn, letters)

print('\nInsertion finished. Results are below:')
rows = db.select_all_letters(conn)
print(str(len(rows)) + ' entries')

print(str(os.stat(DB_RESULT).st_size / 1024) + 'KB')

# pre-processing data
# 1. getting letters from db
letter_objects = []

for row in rows:
    id = row[0]
コード例 #9
0
 def drop(self):
     ret = db.drop_table()
     return ret
コード例 #10
0
        if len(current_league_games) == 0:
            # Deleting a record of the league if there were only canceled games in it
            items.remove(item)

        item.find_element_by_css_selector(
            'div.event__expander.icon--expander.collapse').click()
    return games


if __name__ == '__main__':

    logging.info("---------Parser started---------")
    db.create_table()
    DATE = datetime.date.today()
    logging.info(f"set DATE {DATE}")

    while True:
        if DATE != datetime.date.today():
            db.drop_table()
            db.create_table()
            DATE = datetime.date.today()
            logging.info(f"set DATE {DATE}")

        for game_name in ADDRESSES:
            logging.info(f"started get info about {game_name}")
            open_selected_sport_completed_games(game_name)
            games = get_all_leagues(game_name)
            db.add_games(games)

        time.sleep(3600)