-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
21 lines (19 loc) · 890 Bytes
/
models.py
File metadata and controls
21 lines (19 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from typing import Optional
from sqlalchemy import String, Integer
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import mapped_column
from sqlalchemy.orm import relationship
class Base(DeclarativeBase):
pass
class Node(Base):
__tablename__ = "node"
id: Mapped[str] = mapped_column(String(32), primary_key=True)
short_name: Mapped[Optional[str]] = mapped_column(String(255))
long_name: Mapped[Optional[str]] = mapped_column(String(255))
macaddr: Mapped[Optional[str]] = mapped_column(String(17))
hw_model: Mapped[Optional[str]] = mapped_column(Integer)
public_key: Mapped[Optional[str]] = mapped_column(String(255))
latitude: Mapped[Optional[float]] = mapped_column(Integer)
longitude: Mapped[Optional[float]] = mapped_column(Integer)
altitude: Mapped[Optional[float]] = mapped_column(Integer)