Firebird + SQLAlchemy: cyrillic symbols in path to db

  Kiến thức lập trình

I’m trying to open a Firebird database with cyrillic characters in the path, something like this

path_to_fdb = 'D:/базы/mydb.FDB'
db_url = f'firebird+fdb://sysdba:masterkey@/{path_to_fdb}?charset=utf8'
engine = sqlalchemy.create_engine(db_url)
conn = engine.connect()

but always get an error like this

(fdb.fbcore.DatabaseError) ('Error while connecting to database:n- SQLCODE: -902n- I/O error during "CreateFile (open)" operation for file "D:/базы/mydb.FDB"n- Error while trying to open filen- Системе не удается найти указанный путь. ', -902, 335544344)

with gibberish in path like D:/базы/mydb.FDB

Obviosly, everything works fine with latin only. I understand that the problem is in the encoding of path_to_fdb, or rather with its reading, but no matter how i tried to use .encode() .decode() on this with various encodings nothing really helps.
It looks like sqlalchemy-firebird doesn’t understand сyrillic symbols in path to database. Firebird database version – 2.5

SQLAlchemy==2.0.30, sqlalchemy-firebird==2.1, fdb==2.0.2, firebird-base==1.8.0
, firebird-driver==1.10.4

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT