python-plugins 1.0.3__py3-none-any.whl → 1.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +0,0 @@
1
- from typing import Optional
2
- from .. import db
3
- from ..orm import Mapped
4
- from ..orm import mapped_column
5
-
6
- # see https://docs.sqlalchemy.org/en/20/orm/inheritance.html#single-inheritance
7
- # see https://docs.sqlalchemy.org/en/20/orm/queryguide/_single_inheritance.html
8
-
9
- class Employee(db.Model):
10
- __tablename__ = "employee"
11
- id: Mapped[int] = mapped_column(primary_key=True)
12
- name: Mapped[str]
13
- type: Mapped[str]
14
-
15
- def __repr__(self):
16
- return f"{self.__class__.__name__}({self.name!r})"
17
-
18
- __mapper_args__ = {
19
- "polymorphic_identity": "employee",
20
- "polymorphic_on": "type",
21
- }
22
-
23
-
24
- class Manager(Employee):
25
- manager_name: Mapped[str] = mapped_column(nullable=True)
26
- __mapper_args__ = {
27
- "polymorphic_identity": "manager",
28
- }
29
-
30
-
31
- class Engineer(Employee):
32
- engineer_info: Mapped[str] = mapped_column(nullable=True)
33
- __mapper_args__ = {
34
- "polymorphic_identity": "engineer",
35
- }
@@ -1,74 +0,0 @@
1
- from typing import List
2
- from typing import Set
3
- from .. import db
4
- from ..orm import Mapped
5
- from ..orm import mapped_column
6
- from ..orm import ForeignKey
7
- from ..orm import relationship
8
- from ..orm import Table
9
- from ..orm import Column
10
- from ..orm import Integer
11
-
12
-
13
- class OneToManyParent(db.Model):
14
- __tablename__ = "one_to_many_parent"
15
- id: Mapped[int] = mapped_column(primary_key=True)
16
- children: Mapped[List["ManyToOneChild"]] = relationship()
17
- children2: Mapped[List["ManyToOneChild2"]] = relationship(back_populates="parent2")
18
- children3: Mapped[Set["ManyToOneChild3"]] = relationship(back_populates="parent3")
19
-
20
-
21
- class ManyToOneChild(db.Model):
22
- __tablename__ = "many_to_one_child1"
23
- id: Mapped[int] = mapped_column(primary_key=True)
24
- parent_id: Mapped[int] = mapped_column(ForeignKey("one_to_many_parent.id"))
25
-
26
-
27
- class ManyToOneChild2(db.Model):
28
- __tablename__ = "many_to_one_child2"
29
- id: Mapped[int] = mapped_column(primary_key=True)
30
- parent_id: Mapped[int] = mapped_column(ForeignKey("one_to_many_parent.id"))
31
- parent2: Mapped["OneToManyParent"] = relationship(back_populates="children2")
32
-
33
-
34
- class ManyToOneChild3(db.Model):
35
- __tablename__ = "many_to_one_child3"
36
- id: Mapped[int] = mapped_column(primary_key=True)
37
- parent_id: Mapped[int] = mapped_column(ForeignKey("one_to_many_parent.id"))
38
- parent3: Mapped["OneToManyParent"] = relationship(back_populates="children3")
39
-
40
- class OneToOneParent(db.Model):
41
- __tablename__ = "one_to_one_parent"
42
- id: Mapped[int] = mapped_column(primary_key=True)
43
- child: Mapped["OneToOneChild"] = relationship(back_populates="parent")
44
-
45
-
46
- class OneToOneChild(db.Model):
47
- __tablename__ = "one_to_one_child"
48
- id: Mapped[int] = mapped_column(primary_key=True)
49
- parent_id: Mapped[int] = mapped_column(ForeignKey("one_to_one_parent.id"))
50
- parent: Mapped["OneToOneParent"] = relationship(back_populates="child")
51
-
52
-
53
- association_table = Table(
54
- "many_to_many_association",
55
- db.Model.metadata,
56
- Column("left_id", Integer, ForeignKey("many_to_many_left.id"), primary_key=True),
57
- Column("right_id", Integer, ForeignKey("many_to_many_right.id"), primary_key=True),
58
- )
59
-
60
-
61
- class ManyToManyLeft(db.Model):
62
- __tablename__ = "many_to_many_left"
63
- id: Mapped[int] = mapped_column(primary_key=True)
64
- rights: Mapped[List["ManyToManyRight"]] = relationship(
65
- secondary=association_table, back_populates="lefts"
66
- )
67
-
68
-
69
- class ManyToManyRight(db.Model):
70
- __tablename__ = "many_to_many_right"
71
- id: Mapped[int] = mapped_column(primary_key=True)
72
- lefts: Mapped[List["ManyToManyLeft"]] = relationship(
73
- secondary=association_table, back_populates="rights"
74
- )
@@ -1,17 +0,0 @@
1
- from .. import db
2
- from ..orm import ForeignKey
3
- from ..orm import Mapped
4
- from ..orm import mapped_column
5
- from ..orm import relationship
6
-
7
- # Adjacency List Relationships
8
- # see https://docs.sqlalchemy.org/en/20/orm/self_referential.html
9
-
10
-
11
- class TreeNode(db.Model):
12
- __tablename__ = "tree_node"
13
- id: Mapped[int] = mapped_column(primary_key=True)
14
- parent_id = mapped_column(ForeignKey("tree_node.id"))
15
- data: Mapped[str]
16
- children = relationship("TreeNode", back_populates="parent")
17
- parent = relationship("TreeNode", back_populates="children", remote_side=[id])
File without changes