Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphene-sqlalchemy does not support sqlalchemy.dialects.mysql.LONGBLOB types. #1112

Closed
ygbourhis opened this issue Dec 12, 2019 · 3 comments
Labels

Comments

@ygbourhis
Copy link

Imagine you have a model like this:

class CSITECONTENT(Base):
    __tablename__ = 'C_SITE_CONTENT'

    CONTENT_KEY = Column(String(50), primary_key=True)
    CONTENT_VAL = Column(LONGBLOB, nullable=False)
    MIME_TYPE = Column(String(50), nullable=False)
    CREATED_DATE = Column(TIMESTAMP, nullable=False, server_default=text("'0000-00-00 00:00:00'"))
    MODIFIED_DATE = Column(TIMESTAMP, nullable=False, server_default=text("'0000-00-00 00:00:00'"))

graphene-sqlalchemy will raise:

Exception: Don't know how to convert the SQLAlchemy field C_SITE_CONTENT.CONTENT_VAL (<class 'sqlalchemy.sql.schema.Column'>)
@ygbourhis
Copy link
Author

graphene-sqlalchemy is not the only one to have issues with LONGBLOB:

shosca/django-rest-witchcraft#59

@kazamatzuri
Copy link

If you use

Data = Column(LargeBinary(length=(2 ** 32) - 1), nullable=True)

Instead (https://docs.sqlalchemy.org/en/13/core/type_basics.html)
Which sqlalchemy maps to a longblob:

+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| id        | int(11)      | NO   | PRI | NULL    | auto_increment |
| Name      | varchar(300) | NO   |     | NULL    |                |
| Data      | longblob     | YES  |     | NULL    |                |
+-----------+--------------+------+-----+---------+----------------+

graphene can then deal with it just fine

@stale
Copy link

stale bot commented Apr 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 8, 2020
@stale stale bot closed this as completed Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants