langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

[WIP] add Sqldatabase.ts file to be able to create SQLDatabaseChain after that

Open MaximeThoonsen opened this issue 2 years ago • 3 comments

MaximeThoonsen avatar Feb 26 '23 23:02 MaximeThoonsen

To test it with Typeorm, you can create a dataSource like this:

import { DataSource } from "typeorm";

const postgresDataSource = new DataSource({
    type: "postgres",
    host: "localhost",
    port: 5432,
    username: "nestjs",
    password: "...",
    database: "...",
});

MaximeThoonsen avatar Feb 26 '23 23:02 MaximeThoonsen

this looks great! I added basic, sqlite only support in #132. We can consolidate there? Happy to help

agola11 avatar Feb 27 '23 22:02 agola11

Hey @agola11 , just finished the sqldatabasechain + start the generic of sqldatabase.ts Is it ok for you if we merge this and then we refacto to take into account what you did for sqlite?

MaximeThoonsen avatar Mar 01 '23 16:03 MaximeThoonsen

Great work! How many sql databases will this support? (I guess this is limited by typeorm?)

tonyabracadabra avatar Mar 07 '23 05:03 tonyabracadabra

Hey @tonyabracadabra . Yes final state should be all database supported by TypeOrm. For the moment pg and sqlite. But it's not a lot of work to add one as you can see in my last commit

MaximeThoonsen avatar Mar 07 '23 12:03 MaximeThoonsen

Hi @MaximeThoonsen -- thanks for the work on this so far! There are a couple of things @nfcampos and I want to do in order to merge this PR in by tomorrow: namely, add some tests, examples, docs, and convenience functions. In order to do that, I'll merge this PR in into a branch ankush/sql-database in the main hwchase17/langchainjs repo. You'll still be associated with the commit once it gets merged in to hwchase17/langchainjs:main.

agola11 avatar Mar 08 '23 00:03 agola11

Hey @agola11 ok thanks for the help.

MaximeThoonsen avatar Mar 08 '23 16:03 MaximeThoonsen

@MaximeThoonsen Hi trying to test with typeorm + pg, any idea why this issue occur? image This is my datasource: const datasource = new DataSource({ type: type, host: host, port: parseInt(port), username: username, password: password, database: database, synchronize: true, logging: true, }) Thanks in advance

buenaSopa avatar May 12 '23 13:05 buenaSopa

@buenaSopa do you have installed the pg package ?

MaximeThoonsen avatar May 14 '23 10:05 MaximeThoonsen

@MaximeThoonsen yep, I've installed everything needed. I've decided to create a new project and it works there, so things kinda sorted out for now. Thanks tho

buenaSopa avatar May 14 '23 10:05 buenaSopa