Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /topoteretes_cognee /cognee /modules /graph /legacy /GraphRelationshipLedger.py
| from uuid import uuid5, NAMESPACE_OID | |
| from datetime import datetime, timezone | |
| from sqlalchemy import UUID, Column, DateTime, String, Index | |
| from cognee.infrastructure.databases.relational import Base | |
| class GraphRelationshipLedger(Base): | |
| __tablename__ = "graph_relationship_ledger" | |
| id = Column( | |
| UUID, | |
| primary_key=True, | |
| default=lambda: uuid5(NAMESPACE_OID, f"{datetime.now(timezone.utc).timestamp()}"), | |
| ) | |
| source_node_id = Column(UUID, nullable=False) | |
| destination_node_id = Column(UUID, nullable=False) | |
| creator_function = Column(String, nullable=False) | |
| # TODO(security): node_label stores readable entity names (e.g. "Apple", "John"). | |
| # Evaluate whether this needs hashing/minimization for SOC2 compliance. | |
| # Align with Pavel/compliance requirements. Tracked as near-term security follow-up. | |
| node_label = Column(String, nullable=True) | |
| created_at = Column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)) | |
| deleted_at = Column(DateTime(timezone=True), nullable=True) | |
| user_id = Column(UUID, nullable=True) | |
| # Create indexes | |
| __table_args__ = ( | |
| Index("idx_graph_relationship_id", "id"), | |
| Index("idx_graph_relationship_ledger_source_node_id", "source_node_id"), | |
| Index("idx_graph_relationship_ledger_destination_node_id", "destination_node_id"), | |
| ) | |
| def to_json(self) -> dict: | |
| return { | |
| "id": str(self.id), | |
| "source_node_id": str(self.parent_id), | |
| "destination_node_id": str(self.child_id), | |
| "creator_function": self.creator_function, | |
| "created_at": self.created_at.isoformat(), | |
| "deleted_at": self.deleted_at.isoformat() if self.deleted_at else None, | |
| "user_id": str(self.user_id), | |
| } | |
Xet Storage Details
- Size:
- 1.81 kB
- Xet hash:
- 806a731255dc891ea87af2b055ac9dd8f02eca27b9273d487e9e4c12dd6371ff
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.