-
-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
Description
Describe the Bug
Declared a table field with vcol (virtual column) but column ended up being create on the database
Steps to Reproduce
- Declaring a a table field using
vcol:
@alias_ctx(create="add", read="get", list="browse")
class Book(Base):
__tablename__ = "books"
...
# Virtual, read-only derived field
slug: Mapped[str] = vcol(
field=F(py_type=str, constraints={"max_length": 256}),
io=IO(out_verbs=("read","list")),
read_producer=lambda obj, ctx: f"{(obj.title or '').strip().lower().replace(' ','-')}-{(obj.author or '').strip().lower().replace(' ','-')}"
)- Make a Create api request call.
- Results to a SQL related error
Software Version
<0.4.0
Python Version
Python 3.8
Environment Details
No response
Relevant Logs or Error Output
{
"detail": "<class 'sqlalchemy.exc.IntegrityError'>: (sqlite3.IntegrityError) NOT NULL constraint failed: books.slug\n[SQL: INSERT INTO books (title, author, price, published_at, slug) VALUES (?, ?, ?, ?, ?)]\n[parameters: ('string', 'string', 0.0, None, None)]\n(Background on this error at: https://sqlalche.me/e/20/gkpj)"
}Additional Context (Optional)
No response
Confirmation
- I have searched the existing issues for this bug.
- I have provided all necessary information to reproduce the bug.