treemap.py
2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from sqlalchemy.orm import Mapped, mapped_column
from presupuestov1.schema import BaseModel
from sqlalchemy import (
Integer,
String,
Text,
Numeric,
Index,
MetaData,
)
class TreemapObjeto(BaseModel):
__tablename__ = "treemap_objeto"
__table_args__ = (
Index("idx_treemap_objeto_gestion_entidad", "gestion", "entidad"),
)
# PK compuesta inferida para uso ORM
gestion: Mapped[int] = mapped_column(Integer, primary_key=True)
entidad: Mapped[int] = mapped_column(Integer, primary_key=True)
nivel: Mapped[str] = mapped_column(String(20), primary_key=True)
objeto: Mapped[int] = mapped_column(Integer, primary_key=True)
desc_objeto: Mapped[str | None] = mapped_column(Text)
parent: Mapped[int | None] = mapped_column(Integer)
devengado: Mapped[float | None] = mapped_column(Numeric)
class TreemapFinFun(BaseModel):
__tablename__ = "treemap_finfun"
__table_args__ = (
Index("idx_treemap_finfun_gestion_entidad", "gestion", "entidad"),
)
# PK compuesta inferida para uso ORM
gestion: Mapped[int] = mapped_column(Integer, primary_key=True)
entidad: Mapped[int] = mapped_column(Integer, primary_key=True)
nivel: Mapped[str] = mapped_column(String(20), primary_key=True)
finfun: Mapped[int] = mapped_column(String(9), primary_key=True)
desc_finfun: Mapped[str | None] = mapped_column(Text)
parent: Mapped[int | None] = mapped_column(Integer)
devengado: Mapped[float | None] = mapped_column(Numeric)
class TreemapActeco(BaseModel):
__tablename__ = "treemap_acteco"
__table_args__ = (
Index("idx_treemap_acteco_gestion_entidad", "gestion", "entidad"),
)
# PK compuesta inferida para uso ORM
gestion: Mapped[int] = mapped_column(Integer, primary_key=True)
entidad: Mapped[int] = mapped_column(Integer, primary_key=True)
nivel: Mapped[str] = mapped_column(String(20), primary_key=True)
acteco: Mapped[int] = mapped_column(String(9), primary_key=True)
desc_actividad: Mapped[str | None] = mapped_column(Text)
parent: Mapped[int | None] = mapped_column(Integer)
devengado: Mapped[float | None] = mapped_column(Numeric)