A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/sqlalchemy/sqlalchemy/discussions/8962 below:

Using Result.freeze() when Result was returned by exec_driver_sql · sqlalchemy/sqlalchemy · Discussion #8962 · GitHub

Using either sqlalchemy 1.4.44 or 2.0.0b4, in the code snippet below, the 2nd call to result.freeze() raises

TypeError: can only concatenate tuple (not "NoneType") to tuple

I don't see this in the documentation. Is freeze() not allowed on a resultset that comes from exec_driver_sql?

from pathlib import Path
import sqlalchemy as sa

metadata = sa.MetaData()

user = sa.Table(
    "user",
    metadata,
    sa.Column("user_id", sa.Integer, primary_key=True),
    sa.Column("user_name", sa.String(16), nullable=False),
    sa.Column("email_address", sa.String(60)),
    sa.Column("nickname", sa.String(50), nullable=False),
)

db_file = Path(r"C:\Temp\test.db")
db_file.unlink(missing_ok=True)
db_uri = "sqlite:///" + str(db_file)
engine = sa.create_engine(db_uri, future=True)
user.create(bind=engine)
with engine.connect() as conn:
    result = conn.execute(sa.select(user))
    frozen = result.freeze()
    result = conn.exec_driver_sql("select * from user")
    frozen = result.freeze()
engine.dispose()
db_file.unlink()

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4