* feat: add sqlalchemy as dlt destination * Fix the demo, update Readme * fix: add 1.5 notebook --------- Co-authored-by: Vasilije <8619304+Vasilije1990@users.noreply.github.com>
22 lines
647 B
Python
22 lines
647 B
Python
from sqlalchemy.orm import relationship, Mapped
|
|
from sqlalchemy import Column, String, ForeignKey
|
|
from cognee.infrastructure.databases.relational import UUID
|
|
from .Principal import Principal
|
|
from .UserGroup import UserGroup
|
|
|
|
class Group(Principal):
|
|
__tablename__ = "groups"
|
|
|
|
id = Column(UUID, ForeignKey("principals.id"), primary_key = True)
|
|
|
|
name = Column(String, unique = True, nullable = False, index = True)
|
|
|
|
users: Mapped[list["User"]] = relationship(
|
|
"User",
|
|
secondary = UserGroup.__tablename__,
|
|
back_populates = "groups",
|
|
)
|
|
|
|
__mapper_args__ = {
|
|
"polymorphic_identity": "group",
|
|
}
|