-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Describe the bug
I have database columns of type BLOB SUB_TYPE 1. My code is working fine SQLAlchemy 1.4.54 and sqlalchemy-firebird 0.8.0, but when I run with 2.0.39 and 2.1, I am getting errors
TypeError: string argument without an encoding
This is occurring with both firebird+fdb and firebird+firebird. charset is set to UTF8 or utf-8 in the connection string.
To Reproduce
- Create database and populate:
CREATE TABLE THE_BLOB (TEXT BLOB SUB_TYPE TEXT SEGMENT SIZE 80);
insert into the_blob values ('hi');
- Fetch rows:
import os
from sqlalchemy import MetaData, create_engine
from sqlalchemy.sql import select
db = create_engine(
"firebird+firebird://%s:%s@%s:%d/%s?charset=utf-8"
% ("SYSDBA", "masterkey", "localhost", 3050, os.path.join(os.getcwd(), "blob.fdb")),
)
metadata = MetaData()
metadata.bind = db
metadata.reflect(db)
blob_table = metadata.tables["the_blob"]
with db.connect() as conn:
blobs = conn.execute(select(blob_table))
for row in blobs:
print(row)
- See error:
Traceback (most recent call last):
File "/home/hamish/dev/pyservices/blobtest.py", line 37, in <module>
for row in blobs:
File "/home/hamish/dev/pyservices/venv/lib/python3.11/site-packages/sqlalchemy/engine/result.py", line 529, in iterrows
make_row(raw_row) if make_row else raw_row
^^^^^^^^^^^^^^^^^
File "lib/sqlalchemy/cyextension/resultproxy.pyx", line 22, in sqlalchemy.cyextension.resultproxy.BaseRow.__init__
File "lib/sqlalchemy/cyextension/resultproxy.pyx", line 79, in sqlalchemy.cyextension.resultproxy._apply_processors
File "/home/hamish/dev/pyservices/venv/lib/python3.11/site-packages/sqlalchemy/sql/sqltypes.py", line 921, in process
value = bytes(value)
^^^^^^^^^^^^
TypeError: string argument without an encoding
Expected behavior
Blob should be returned. When run on sqlalchemy 1, this runs successfully:
$ python3 blobtest.py
('hi',)
Desktop (please complete the following information):
- OS: Debian Linux 12
- sqlalchemy 2.0.39
- sqlalchemy-firebird 2.1
Metadata
Metadata
Assignees
Labels
No labels