MCPcopy
hub / github.com/llmware-ai/llmware / connect

Method connect

llmware/resources.py:3048–3065  ·  view source on GitHub ↗

Connect to Postgres DB - using config data in PostgresConfig

(self, db_name=None, collection_name=None)

Source from the content-addressed store, hash-verified

3046 self.conn = None
3047
3048 def connect(self, db_name=None, collection_name=None):
3049
3050 """Connect to Postgres DB - using config data in PostgresConfig"""
3051
3052 self.postgres_host = PostgresConfig().get_config("host")
3053 self.postgres_port = PostgresConfig().get_config("port")
3054 self.postgres_user_name = PostgresConfig().get_config("user_name")
3055 self.postgres_pw = PostgresConfig().get_config("pw")
3056
3057 # postgres will use the configured db name
3058 # if db_name: self.postgres_db_name = db_name
3059
3060 self.postgres_db_name = PostgresConfig().get_config("db_name")
3061
3062 self.conn = psycopg.connect(host=self.postgres_host, port=self.postgres_port, dbname=self.postgres_db_name,
3063 user=self.postgres_user_name, password=self.postgres_pw)
3064
3065 return self.conn
3066
3067
3068class _SQLiteConnect:

Callers 13

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
test_connectionMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
connectMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 2

PostgresConfigClass · 0.90
get_configMethod · 0.45

Tested by 2

test_connectionMethod · 0.36
clean_the_environmentMethod · 0.36