Skip to content

Use SynapCores from Python: pip install, SQL and vector search

The synapcores package on PyPI talks to your engine over its REST API. Install it with pip, log in, and run SQL from Python, including vector search with embeddings the database computes for you.

Tested on SynapCores 2.5.0-ceUpdated November 18, 2026

Install free, one command

curl -fsSL https://get.synapcores.com | SYNAPCORES_REF=docs-python sh

Free Community Edition. Linux (x86_64, aarch64) and macOS on Apple Silicon; Windows via WSL2. Docker and other options

You need a running engine (quickstart or Docker), its admin password, and Python 3.8 or later.

Install the SDK

bash
python3 -m venv venv
source venv/bin/activate
pip install synapcores
python -c "import synapcores; print(synapcores.__version__)"
Output
0.5.0

Save this as quickstart.py. It creates a small table of help articles, embeds them inside the database, and finds the article closest in meaning to a question:

quickstart.py
import os
from synapcores import SynapCores

client = SynapCores(host="localhost", port=8080)
client.login(os.environ["SYNAPCORES_USER"], os.environ["SYNAPCORES_PASSWORD"])

# A throwaway database keeps the demo away from your own tables.
client.sql("CREATE DATABASE IF NOT EXISTS py_quickstart")
client.sql("""CREATE TABLE IF NOT EXISTS py_quickstart.articles (
    id INTEGER PRIMARY KEY, title TEXT, body TEXT, embedding VECTOR(384))""")

articles = [
    [1, "Reset your password", "Click Forgot password at sign-in to get a reset link."],
    [2, "Update billing details", "Change the card on file under Settings > Billing."],
    [3, "Export your data", "Download your records as a CSV from Settings > Export."],
    [4, "Invite teammates", "Add colleagues to your workspace in Settings > Members."],
]
# EMBED() turns each body into a 384-dim vector inside the database.
for row in articles:
    client.sql("INSERT INTO py_quickstart.articles VALUES ($1, $2, $3, EMBED($3))", row)

print(client.sql("SELECT id, title FROM py_quickstart.articles ORDER BY id"))

question = "I'm locked out of my account"
hits = client.sql("""SELECT title, COSINE_SIMILARITY(embedding, EMBED($1)) AS score
    FROM py_quickstart.articles ORDER BY score DESC LIMIT 3""", [question])
print(f"\nTop matches for {question!r}:\n{hits}")

client.sql("DROP DATABASE py_quickstart")
client.close()
bash
export SYNAPCORES_USER=admin
export SYNAPCORES_PASSWORD='your-admin-password'
python quickstart.py
Output
   id                   title
0   1     Reset your password
1   2  Update billing details
2   3        Export your data
3   4        Invite teammates

Top matches for "I'm locked out of my account":
                    title     score
0     Reset your password  0.537934
1  Update billing details  0.199136
2        Invite teammates  0.174465

The question and the top article share no keywords; the match comes from the embeddings. The script drops its database at the end, so you can run it again.

How it works

  • client.sql() sends a statement to POST /v1/query/execute. Use $1, $2, … placeholders and pass the values as a list.
  • Rows come back as a pandas DataFrame, so you can filter, join or plot them straight away.
  • EMBED(text) creates a 384-dimension embedding with the local all-MiniLM model inside the engine, and COSINE_SIMILARITY() ranks rows against the question. Your Python code never handles vectors.
  • Database-qualified names such as py_quickstart.articles let one client work across databases.

Connect with an API key

For services and scripts that run unattended, pass an API key instead of logging in (the MCP guide shows how to create one):

Python
import os
from synapcores import SynapCores

client = SynapCores(host="localhost", port=8080, api_key=os.environ["SYNAPCORES_API_KEY"])
print(client.sql("SELECT 1 + 1 AS two"))
Output
   two
0    2

Go further

  • client.sql() runs any statement the engine accepts over REST. The SQL reference lists every function, from agent memory to AutoML.
  • Building a RAG app? The LlamaIndex guide stores chunks in the engine, retrieves them with a vector search like the one above and answers with a chat model the same engine serves through its Ollama-compatible API, so retrieval and generation stay on your machine.

Next steps

Full reference

  • SQL reference: Every statement and function: EMBED, VECTOR, COSINE_SIMILARITY, GENERATE, Cypher, AutoML, agent memory.
  • API reference: The REST API. Your engine also serves its own OpenAPI schema at /v1/openapi.json.
  • System requirements: Supported platforms, memory and disk sizing.