(address, logger, name)
| 70 | |
| 71 | |
| 72 | def create_database(address, logger, name): |
| 73 | try: |
| 74 | connection = sqlite3.connect(address) |
| 75 | with connection: |
| 76 | connection.row_factory = sqlite3.Row |
| 77 | cursor = connection.cursor() |
| 78 | |
| 79 | create_tables( |
| 80 | cursor, |
| 81 | [ |
| 82 | "profiles", |
| 83 | "recordActivity", |
| 84 | "followRestriction", |
| 85 | "shareWithPodsRestriction", |
| 86 | "commentRestriction", |
| 87 | "accountsProgress", |
| 88 | ], |
| 89 | ) |
| 90 | |
| 91 | connection.commit() |
| 92 | |
| 93 | except Exception as exc: |
| 94 | logger.warning( |
| 95 | "Wah! Error occurred while getting a DB for '{}':\n\t{}".format( |
| 96 | name, str(exc).encode("utf-8") |
| 97 | ) |
| 98 | ) |
| 99 | |
| 100 | finally: |
| 101 | if connection: |
| 102 | # close the open connection |
| 103 | connection.close() |
| 104 | |
| 105 | |
| 106 | def create_tables(cursor, tables): |
no test coverage detected