Skip to content

Library throws 'super' object has no attribute 'coerce' when column value is null() #55

Description

@eskuat

Code to reproduce the exception

from sqlalchemy import Column
from sqlalchemy import create_engine, null, Integer
from sqlalchemy.dialects.sqlite import JSON
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy_json import mutable_json_type

Base = declarative_base()
eng = create_engine("sqlite://")


class JTable(Base):
    __tablename__ = 'jtable'
    id = Column(Integer, primary_key=True)
    value = Column(mutable_json_type(JSON, nested=True))


def create_table():
    conn = eng.connect()
    conn.execute(
        """
        CREATE TABLE IF NOT EXISTS jtable  (
            id INTEGER PRIMARY KEY,
            value TEXT NULL
        );
        """
    )


if __name__ == "__main__":
    create_table()
    # throws - AttributeError: 'super' object has no attribute 'coerce'
    row = JTable(value=null())

This seem very similar to #10 and probably can be solved by adding similar checks.
I can prepare a PR if necessary

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions