Skip to content

Instanciating a model with **kwrgs #50

@mehdigmira

Description

@mehdigmira

Hello,

Is there something wrong in the following code ?

from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base


Base = declarative_base()


class User(Base):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    name = Column(String)


class Address(Base):
    __tablename__ = 'addresses'
    id = Column(Integer, primary_key=True)
    name = Column(String)


User(name="x")

d = {"name": "x"}

User(**d)  # causes error: Unexpected column "None" for model "User"

Is this the expected behaviour ?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions