Projekt

Obecné

Profil

Stáhnout (538 Bajtů) Statistiky
| Větev: | Revize:
1
from Utilities.Database import database_loader
2

    
3

    
4
def clean_database() -> None:
5
    """
6
    Drops every collection in database
7
    """
8
    # Creating connection
9
    mydb = database_loader.create_database_connection()
10

    
11
    # Retrieve list of all collections
12
    collections = mydb.list_collection_names()
13

    
14
    # Drop of all collections
15
    for name in collections:
16
        print(name)
17
        mydb[name].drop()
18

    
19

    
20
def main() -> None:
21
    print('Data z databáze budou smazána:')
22
    clean_database()
23

    
24

    
25
if __name__ == "__main__":
26
    main()
(6-6/13)