Skip to content

pgvector/pgvector-cobol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgvector-cobol

pgvector examples for COBOL

Supports Open Cobol ESQL

Build Status

Getting Started

Follow the instructions for your database library:

Open Cobol ESQL

Enable the extension

EXEC SQL
    CREATE EXTENSION IF NOT EXISTS vector
END-EXEC.

Create a table

EXEC SQL
    CREATE TABLE items (
        id bigserial PRIMARY KEY,
        embedding vector(3)
    )
END-EXEC.

Insert vectors

MOVE "[1,2,3]" TO EMBEDDING.
MOVE "[4,5,6]" TO EMBEDDING2.
EXEC SQL
    INSERT INTO items (embedding)
        VALUES (:EMBEDDING), (:EMBEDDING2)
END-EXEC.

Get the nearest neighbor

MOVE "[3,1,2]" TO EMBEDDING.
EXEC SQL
    SELECT id INTO :NEAREST-ID FROM items
        ORDER BY embedding <-> :EMBEDDING LIMIT 5
END-EXEC.

See a full example

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/pgvector/pgvector-cobol.git
cd pgvector-cobol
createdb pgvector_cobol_test
ocesql example.cbl example.cob
export COBCPY=path/to/Open-COBOL-ESQL/copy
cobc -x -locesql example.cob
./example

About

pgvector examples for COBOL

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages