Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
correcting sql_data
Browse files Browse the repository at this point in the history
  • Loading branch information
kotorkovsciy committed Aug 10, 2022
1 parent 8007591 commit 36c0af1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/sql_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from os import getenv
from os import getenv, mkdir
from os.path import exists
from dotenv import load_dotenv
from psycopg2 import connect
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
Expand Down Expand Up @@ -230,6 +231,8 @@ async def deleteJokes(self):

async def dump(self, user_id):
"""Дамп бд"""
if not exists("sql/"):
mkdir("sql/")
self.__open__()
self.cursor.execute('SELECT * FROM users')
with open(f"sql\dump_users_{user_id}.sql", "w", encoding='utf 8') as file:
Expand Down

0 comments on commit 36c0af1

Please sign in to comment.