# Adding vectors into records

**URL:** <https://forum.weaviate.io/t/adding-vectors-into-records/21725>\
**Category:** Support\
**Created:** [July 27, 2025, 3:38am UTC](https://forum.weaviate.io/t/adding-vectors-into-records/21725 "2025-07-27T03:38:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mscottgithub](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/mscottgithub/32/7519_2.png) [@mscottgithub](https://forum.weaviate.io/u/mscottgithub)\
**Post date:** [July 27, 2025, 3:38am UTC](https://forum.weaviate.io/t/adding-vectors-into-records/21725/1 "2025-07-27T03:38:12Z")

</div>

Very frustrated, mostly at myself because I am BRAND NEW to Weaviate and just don’t know what I’m doing.-

Weaviate Server Version: 1.31.7

- Deployment Method: No Docker–full deployment on Ubuntu  
-Single Server running Weaviate
- Client Language and Version: Python client v4.16.4

The issue is so simple and that is why I am so frustrated. I have a postgres table and one of the fields in it is pgvector, 4096 dimensions. This table has only 40 records in it. I am creating a collection in weaviate and simply trying to create 40 records with metadata and the embedding associated with it. Below is the code I’m using. The code runs, tells me 40 records were successfully added. When I check the records–everything is there EXCEPT the 4096 dimension embedding. The vectors are empty. I’ve looed at it 100 different ways and tried so many different things. I’ve talked to others about it. I just don’t get it. I don’t see what I’m doing wrong.

import os  
import requests  
import json  
import ast  
from dotenv import load\_dotenv  
import psycopg2

# Load .env file

load\_dotenv(‘/home/mintdude/Github/sparky/TestScripts/.env’)

# Read all config from .env

POSTGRES\_URL = os.getenv(“POSTGRES\_URL”)  
WEAVIATE\_URL = os.getenv(“WEAVIATE\_URL”)  
WEAVIATE\_PRIORITY\_CLASS = os.getenv(“WEAVIATE\_PRIORITY\_CLASS”, “PriorityPrototype”)

# Connect to Postgres

conn = psycopg2.connect(POSTGRES\_URL)  
cur = conn.cursor()

# Fetch all records (assuming ‘embedding’ is a pgvector field)

cur.execute(“SELECT id, text, embedding FROM priority\_prototypes”)  
rows = cur.fetchall()

count = 0  
for row in rows:  
proto\_id, text, embedding = row  
# Convert pgvector to Python list if needed  
if isinstance(embedding, memoryview):  
embedding = list(embedding.tobytes()) # handle memoryview case (may need adjustment)  
elif hasattr(embedding, ‘tolist’):  
embedding = embedding.tolist()  
elif isinstance(embedding, str):  
try:  
embedding = ast.literal\_eval(embedding)  
except Exception as e:  
print(f"Failed to parse embedding for proto\_id {proto\_id}: {e}“)  
continue  
if not isinstance(embedding, list):  
print(f"Skipping proto\_id {proto\_id}: embedding not a list!”)  
continue

```
# Compose Weaviate REST API payload
payload = {
    "class": WEAVIATE_PRIORITY_CLASS,
    "properties": {
        "proto_id": str(proto_id),
        "text": text
    },
    "vector": embedding
}
resp = requests.post(WEAVIATE_URL, json=payload)
if resp.status_code not in (200, 201):
    print(f"Error uploading proto_id={proto_id}: {resp.status_code}, {resp.text}")
else:
    count += 1
    print(f"Uploaded proto_id={proto_id} OK")

```

cur.close()  
conn.close()  
print(f"\nUpload complete. {count} objects sent to Weaviate.")

---

<div class="post-metadata">

**Author:** ![Shahin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/shahin/32/8085_2.png) [@Shahin](https://forum.weaviate.io/u/Shahin)\
**Post date:** [July 30, 2025, 8:08am UTC](https://forum.weaviate.io/t/adding-vectors-into-records/21725/2 "2025-07-30T08:08:49Z")

</div>

Hey @mscottgithub

Welcome to the community — it’s really great to have you here! Wishing you a good start and an awesome learning journey ahead.

Let’s figure this out together, no stress at all.

I haven’t tested your code myself since I don’t have a Postgres DB handy, but here are the most common reasons I’ve seen when vectors don’t get stored properly in Weaviate:

**1. Vectorizer Setting**

When you create your collection, make sure the vectorizer is set to “self\_provided”.

If you’re using the Python client v4, that would look like:

```python
Configure.Vectors.self_provided()

```

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/weaviate/original/2X/4/42a660964cb63d25ab734eeba133b4e8839e8f27.png)

If you use something like OpenAI or Cohere as the vectorizer, Weaviate will ignore your provided vectors and create its own.

**2. Vector Format**

Your vector should be a list of floats (like [0.1, 0.2, …]). It shouldn’t be a string, bytes, or a list of strings. Make sure your embedding ends up as a list of 4096 float values

**3. API Endpoint**

Double-check the URL you’re posting to. It should be:

```auto
http(s)://<host>:8080/v1/objects

```

If you’re just posting to the base WEAVIATE\_URL, it won’t work.

Example:

```auto
object_url = f"{WEAVIATE_URL}/v1/objects"
resp = requests.post(object_url, json=payload)

```

Please use the client itself for ingest objects or batching as below:

> **[Quickstart: Bring your own vectors | Weaviate Documentation](https://docs.weaviate.io/weaviate/starter-guides/custom-vectors#import-data-and-vectors)**
>
> Weaviate is a vector database. Vector databases store data objects and vectors that represent those objects. The vector embedding is also called an "embedding."

> **[Batch import | Weaviate Documentation](https://docs.weaviate.io/weaviate/manage-objects/import)**
>
> Batch imports are an efficient way to add multiple data objects and cross-references.

Best,

Mohamed Shahin  
Weaviate Support Engineer  
(Ireland, UTC±00:00/+01:00)
