I have a database where the primary key is supposed to be 256 bytes of data that is an ID that I get from another application.
My problem is SQLAlchemy does not output a length parameter for a primary key, even if the field it involves has it specified when using create_all.
Model
class Route(db.Model):
assignmentId = db.Column(db.Binary(256), primary_key=True, nullable=False)
Things I have tried
- Providing
mysql_lengthin the PrimaryKey table options, but that gets rejected and thus does not work. Error:
sqlalchemy.exc.ArgumentError: Argument 'mysql_length' is not accepted by dialect 'mysql' on behalf of <class 'sqlalchemy.sql.schema.PrimaryKeyConstraint'
Creating Tables via manually outputting a SQL-Statement that contains the required length parameter (Works, but I would really like to avoid sidestepping the ORM like that)
Other stuff that did not lead to anything
I know, my problem is rather specific, but any help towards a solution is really appreciated. Thanks :)