21 lines
506 B
Python
21 lines
506 B
Python
|
|
import os
|
|
|
|
from models.database import Database
|
|
|
|
class Utils:
|
|
@staticmethod
|
|
def clear_screen():
|
|
os.system('cls' if os.name == 'nt' else 'clear')
|
|
|
|
@staticmethod
|
|
def export_db(file):
|
|
with open(f"./{file}", 'w') as f:
|
|
for line in Database.connection.iterdump():
|
|
f.write('%s\n' % line)
|
|
|
|
@staticmethod
|
|
def import_db(file):
|
|
with open(f"./{file}", 'r') as f:
|
|
str = f.read()
|
|
Database.connection.executescript(str) |