Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.md improvement #103

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ Or check out some examples:

## Django

Create a migration to enable the extension
Create an empty migration file

```python
python manage.py makemigrations <your-app-name> --name enable_pgvector --empty
```

Add a migration in that file to enable the extension

```python
from pgvector.django import VectorExtension
Expand All @@ -57,7 +63,14 @@ class Migration(migrations.Migration):
]
```

Add a vector field to your model
Migrate

```sh
python3 manage.py makemigrations
python3 manage.py migrate
```

Add a vector field in the models.py

```python
from pgvector.django import VectorField
Expand All @@ -68,6 +81,13 @@ class Item(models.Model):

Also supports `HalfVectorField`, `BitField`, and `SparseVectorField`

Migrate

```sh
python3 manage.py makemigrations
python3 manage.py migrate
```

Insert a vector

```python
Expand Down