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

feat: Add vector as column type to postgres #10138

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

strongpauly
Copy link
Contributor

@strongpauly strongpauly commented Jun 16, 2023

Description of change

Added vector as column type to postgres

Fixes #10056

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change: N/A
  • This pull request links relevant issues as Fixes #10056
  • There are new or updated unit tests validating the change: N/A
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@strongpauly strongpauly changed the title Add vector as column type to postgres feat: Add vector as column type to postgres Jun 17, 2023
@hinogi
Copy link

hinogi commented Jul 9, 2023

Since vector seems a special use-case and requires the existence of the according extension in the db. I would recommend adding the vector type in a note below the regular types, stating that this needs pgvector to be present in order to work.

@strongpauly
Copy link
Contributor Author

Added a note in the English docs

@andreymyssak
Copy link

Hello @hinogi, it would be great to have such a feature in a new release, when can we expect it?

@Thore1954
Copy link

This feature is needed but this PR is incomplete. It doesn't support passing dimensions, using indexes for approximate search, installing the extension automatically or have any tests.
Pleases see #2423 as a reference.

@hinogi
Copy link

hinogi commented Jul 30, 2023

Hello @hinogi, it would be great to have such a feature in a new release, when can we expect it?

I am not a maintainer, I just try to help out with additional code reviews and stuff.

@GuilleAntico
Copy link

please merge this PR, I need the feature and forking isn't working!

@AlexMesser
Copy link
Collaborator

@strongpauly please update Postgres column types test with the new type to make sure synchronization works as expected

@Thore1954
Copy link

Would be nice if you also update Postgres driver to install the extention automatically.

@GuilleAntico
Copy link

any news on this?

@hinogi
Copy link

hinogi commented Sep 23, 2023

Sorry, I can do nothing.

@strongpauly
Copy link
Contributor Author

I created this PR because it was a simple change that I was already hacking in in my codebase. However, the requested additions require more time than I can devote at the moment. Apologies. Feel free to take what I've started and expand upon it.

@nrathi
Copy link

nrathi commented Oct 6, 2023

@strongpauly how did you hack it?

I'm getting this error:

"DataTypeNotSupportedError: Data type \\\"vector\\\" in \\\"Entity.embedding\\\" is not supported by \\\"postgres\\\" database.

@strongpauly
Copy link
Contributor Author

import { ColumnType, DataSource, DataSourceOptions } from 'typeorm';
export const dataSourceFactory = (options?: DataSourceOptions): DataSource => {
    const dataSource = new DataSource(options);
    dataSource.driver.supportedDataTypes.push('vector' as ColumnType);
    dataSource.driver.withLengthColumnTypes.push('vector' as ColumnType);
    return dataSource;
};

@pleerock
Copy link
Member

pleerock commented Jan 2, 2024

Comments in this PR must be addressed before it can be merged.

@firtoz firtoz mentioned this pull request Mar 24, 2024
7 tasks
@firtoz
Copy link

firtoz commented Mar 24, 2024

Created #10789 to address the issues FYI @pleerock - can you please take a look?

@lukasholzer
Copy link

what's the status of this one would love to see this in typeorm! ❤️

@firtoz
Copy link

firtoz commented Apr 22, 2024

what's the status of this one would love to see this in typeorm! ❤️

@lukasholzer I have been using a build from my branch via #10789 which works quite well for my usecases.

I won't be able to update my code any more since I have moved on from typeorm to another ORM because of various issues, but anyone's free to spin off from it if they like.

@lukasholzer
Copy link

@firtoz thanks so much!

Out of curiosity which ORM did you choose and why? MikroORM?

@firtoz
Copy link

firtoz commented Apr 22, 2024

@lukasholzer trying out drizzle for now, the community and the repo feels active, may consider prisma if it doesn't work out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
10 participants