]> git.mxchange.org Git - fba.git/blob - fba/database.py
Continued:
[fba.git] / fba / database.py
1 # Copyright (C) 2023 Free Software Foundation
2 #
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU Affero General Public License as published
5 # by the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU Affero General Public License for more details.
12 #
13 # You should have received a copy of the GNU Affero General Public License
14 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
16 import logging
17 import sqlite3
18
19 logging.basicConfig(level=logging.INFO)
20 logger = logging.getLogger(__name__)
21
22 # Connect to database
23 logger.debug("Opening database file blocks.db ...")
24 connection = sqlite3.connect("blocks.db")
25
26 # Attach trace function
27 #connection.set_trace_callback(print)
28
29 # Init row factory
30 logger.debug("connection='%s' - setting row factory ...", connection)
31 connection.row_factory = sqlite3.Row
32
33 # Get cursor
34 cursor = connection.cursor()