Исправлена кодировка pyodbc.
This commit is contained in:
parent
707eef30a5
commit
5ba307c590
1 changed files with 4 additions and 1 deletions
|
|
@ -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):
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue