Исправлена кодировка pyodbc.

This commit is contained in:
Kirill Kirilenko 2026-01-19 18:47:27 +03:00
parent 707eef30a5
commit 5ba307c590

View file

@ -1,10 +1,13 @@
from pyodbc import connect, Row from pyodbc import connect, SQL_CHAR, SQL_WCHAR, Row
from typing import List, Union from typing import List, Union
class BasicDatabase: class BasicDatabase:
def __init__(self, connection_string: str): def __init__(self, connection_string: str):
self.conn = connect(connection_string, autocommit=True) self.conn = connect(connection_string, autocommit=True)
self.conn.setdecoding(SQL_CHAR, encoding='utf-8')
self.conn.setdecoding(SQL_WCHAR, encoding='utf-8')
self.conn.setencoding(encoding='utf-8')
self.cursor = self.conn.cursor() self.cursor = self.conn.cursor()
def get_chats(self): def get_chats(self):