create a database connection :rtype: SqliteDatabase
()
| 11 | |
| 12 | |
| 13 | def create_connection() -> SqliteDatabase: |
| 14 | """ |
| 15 | create a database connection |
| 16 | :rtype: SqliteDatabase |
| 17 | """ |
| 18 | global _db |
| 19 | if _db: |
| 20 | return _db |
| 21 | else: |
| 22 | logger.debug('create new db connection') |
| 23 | _db = SqliteDatabase(get_config('db_path', './scylla.db')) |
| 24 | return _db |
| 25 | |
| 26 | |
| 27 | def create_db_tables(): |