Hi Friends,
I am new to SQLAlchemy and trying to do with the inheriting property ( from
using postgresql_inherits ).
Code for creating a table and insert table is showing below,
*models.py*
> Parent_Table = sqlalchemy.Table(
> "Parent_Table",
> metadata,
> sqlalchemy.Column("Name", sqlalchemy.String),
> sqlalchemy.Column("Description", sqlalchemy.String),
> )
>
> Child_Table = sqlalchemy.Table(
> "Child_Table",
> metadata,
> sqlalchemy.Column("Extra_col", sqlalchemy.String),
> postgresql_inherits=('Parent_Table')
> )
>
* views.py*
>
> async def createPolicy(request):
> query = models.Blueprint.insert().values(
> Name = "Bk",
> Description = "testing SQLA",
> Extra_col = "this for write something"
>
)
> await models.database.execute(query)
>
>
This will show an error
sqlalchemy.exc.CompileError: Unconsumed column names: Name, Description
checked in many sites including SQLA documentation but didn't get a way to
do this. Please help.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/bb50a5e8-0199-406d-b2e3-97f1ce2c111b%40googlegroups.com.