You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to use the connector but i'm getting this error when i try to import the postgres memory store
from semantic_kernel.connectors.memory.postgres import PostgresMemoryStore
semantic_kernel\connectors\memory\postgres\__init__.py:3
from semantic_kernel.connectors.memory.postgres.postgres_memory_store import (PostgresMemoryStore)
semantic_kernel\connectors\memory\postgres\postgres_memory_store.py:9
from psycopg import Cursor
ModuleNotFoundError: No module named 'psycopg'
Is there any samples for SK pg memory connector?
The text was updated successfully, but these errors were encountered:
value = memory_store.retrieve('some_key')
print(f'Retrieved value: {value}')
Close the connection when done
connection.close()
Explanation:
Install Dependencies: Ensure you have the psycopg and semantic-kernel packages installed.
Database Connection Parameters: Update the db_params dictionary with your PostgreSQL database credentials.
Create Connection: Establish a connection to the PostgreSQL database using psycopg2.connect.
Initialize PostgresMemoryStore: Create an instance of PostgresMemoryStore using the database connection.
Initialize Kernel: Pass the memory store to the Kernel initializer.
Example Usage: Demonstrates storing and retrieving data from the memory store.
Close Connection: Ensure the database connection is closed after operations are completed.
Discussed in #6988
Originally posted by jamesmkfoo23 June 27, 2024
Hi, is postgres supported with Python?
Azure docs for Azure PostgreSQL Flexible python shows the usage psycopg2
https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/connect-python?tabs=cmd%2Cpasswordless#create-a-table-and-insert-data . I believe therefore this should be the correct library psycopg2.
Trying to use the connector but i'm getting this error when i try to import the postgres memory store
Is there any samples for SK pg memory connector?
The text was updated successfully, but these errors were encountered: