forked from FrederikBaerentsen/BrickTracker
bricktracker
migrations
sql
views
__init__.py
app.py
config.py
configuration.py
configuration_list.py
exceptions.py
fields.py
instructions.py
instructions_list.py
login.py
metadata.py
metadata_list.py
minifigure.py
minifigure_list.py
navbar.py
parser.py
part.py
part_list.py
rebrickable.py
rebrickable_image.py
rebrickable_minifigure.py
rebrickable_part.py
rebrickable_set.py
rebrickable_set_list.py
record.py
record_list.py
reload.py
retired.py
retired_list.py
set.py
set_list.py
set_status.py
set_status_list.py
socket.py
socket_decorator.py
sql.py
sql_counter.py
sql_migration.py
sql_migration_list.py
sql_stats.py
theme.py
theme_list.py
version.py
wish.py
wish_list.py
docs
static
templates
.dockerignore
.env.sample
.gitignore
CHANGELOG.md
Dockerfile
LICENSE
README.md
__init__.py
app.py
compose.legacy.yml
compose.local.yaml
compose.yaml
entrypoint.sh
requirements.txt
test-server.sh
37 lines
805 B
Python
37 lines
805 B
Python
# Some stats on the database
|
|
class BrickSQLStats(object):
|
|
# Functions
|
|
connect: int
|
|
commit: int
|
|
execute: int
|
|
executescript: int
|
|
fetchall: int
|
|
fetchone: int
|
|
|
|
# Records
|
|
fetched: int
|
|
changed: int
|
|
|
|
def __init__(self, /):
|
|
self.connect = 0
|
|
self.commit = 0
|
|
self.execute = 0
|
|
self.executescript = 0
|
|
self.fetchall = 0
|
|
self.fetchone = 0
|
|
self.fetched = 0
|
|
self.changed = 0
|
|
|
|
# Print the stats
|
|
def print(self, /) -> str:
|
|
items: list[str] = []
|
|
|
|
for key, value in self.__dict__.items():
|
|
if value:
|
|
items.append('{key}: {value}'.format(
|
|
key=key.capitalize(),
|
|
value=value,
|
|
))
|
|
|
|
return ' - '.join(items)
|