Use the LargeBinary
type, which will use the bytea
type on PostgreSQL. You can also use the BYTEA
type directly if you’re only going to use PostgreSQL.
There are other SQL standard types, such as BINARY
, but it’s typically easier to use LargeBinary
since SQLAlchemy will use the preferred type for each database.