File size: 523 Bytes
ac156d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""FalkorDB connection and graph names."""
import os
from functools import lru_cache

from falkordb import FalkorDB

KG = "cortex_kg"      # knowledge graph built from the PDFs
OPS = "cortex_ops"    # operational graph (customers, accounts, transactions)
SANDBOX_PREFIX = "sandbox_"  # one isolated graph per upload session


@lru_cache(maxsize=1)
def db():
    return FalkorDB(host=os.getenv("FALKOR_HOST", "localhost"), port=int(os.getenv("FALKOR_PORT", "6379")))


def graph(name=KG):
    return db().select_graph(name)