Skip to content

Better error message when "prop_name" is not specified for a JSON column #661

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

Closed
zain opened this issue May 2, 2020 · 0 comments · Fixed by #662
Closed

Better error message when "prop_name" is not specified for a JSON column #661

zain opened this issue May 2, 2020 · 0 comments · Fixed by #662
Milestone

Comments

@zain
Copy link

zain commented May 2, 2020

from gino.dialects.asyncpg import JSONB
from myproject.main import db

class MyModel(db.Model):
    __tablename__ = "models"

    id = db.Column(db.BigInteger(), primary_key=True)
    profile_json = db.Column(JSONB(), nullable=False, server_default="{}")

    profile = db.JSONProperty()

This causes the error:

...
    exp = self.make_expression(getattr(owner, self.prop_name)[self.name])
  [Previous line repeated 312 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object

The fix is to add prop_name='profile_json' to the JSONProperty() declaration, but without docs and an error message, it is hard to know that.

fantix added a commit that referenced this issue May 2, 2020
* also support JSON property on non-crud base
* add docs for JSON property
* fixes #661
fantix added a commit that referenced this issue May 4, 2020
* also support JSON property on non-crud base
* add docs for JSON property
* fixes #661
* add prop_name type check
fantix added a commit that referenced this issue May 4, 2020
* also support JSON property on non-crud base
* add docs for JSON property
* fixes #661
* add prop_name type check
fantix added a commit that referenced this issue May 6, 2020
* also support JSON property on non-crud base
* add docs for JSON property
* fixes #661
* add prop_name type check
@fantix fantix added this to the GINO 1.0 milestone May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants