Example using BLOB in SQLAlchemy

前端 未结 4 1311
野趣味
野趣味 2021-02-03 23:34

does anybody have example how to use BLOB in SQLAlchemy?

Regards, Steve

4条回答
  •  粉色の甜心
    2021-02-04 00:16

    From the documentation BINARY seems the way to go: http://docs.sqlalchemy.org/en/latest/dialects/mysql.html

    class sqlalchemy.dialects.mysql.BLOB(length=None) Bases: sqlalchemy.types.LargeBinary

    The SQL BLOB type.

    __init__(length=None) Construct a LargeBinary type.

    Parameters: length – optional, a length for the column for use in DDL statements, for those BLOB types that accept a length (i.e. MySQL). It does not produce a lengthed BINARY/VARBINARY type - use the BINARY/VARBINARY types specifically for those. May be safely omitted if no CREATE TABLE will be issued. Certain databases may require a length for use in DDL, and will raise an exception when the CREATE TABLE DDL is issued.

提交回复
热议问题