premsql icon indicating copy to clipboard operation
premsql copied to clipboard

Fix dsn_or_db_path in readme

Open amard33p opened this issue 1 year ago • 5 comments

amard33p avatar Oct 03 '24 18:10 amard33p

Hi @amard33p thank you for your contribution. However please add an additional line where it should say that the path could either be a local sqlite file or it could be an URI which you just changed. You can add the explanation in the comments.

Anindyadeep avatar Oct 03 '24 19:10 Anindyadeep

Hi @Anindyadeep ...updated the PR.

amard33p avatar Oct 04 '24 08:10 amard33p

Hi @Anindyadeep ...updated the PR.

Hi, thanks could you also add a third way of adding which is a local SQLite file. Because that is also something available. So just add that too on the comments in one or two comment sentence.

Anindyadeep avatar Oct 06 '24 16:10 Anindyadeep

Do you mean like this: dsn_or_db_path = "./data/db/california_schools.sqlite" ? This is not working for me...it throws error:

---------------------------------------------------------------------------
ArgumentError                             Traceback (most recent call last)
<ipython-input-3-b68b462c8a8b> in <cell line: 9>()
      7 dsn_or_db_path = "test.db"
      8 
----> 9 agent = SimpleText2SQLAgent(
     10     dsn_or_db_path=dsn_or_db_path,
     11     generator=Text2SQLGeneratorHF(

6 frames
/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/url.py in _parse_url(name)
    906 
    907     else:
--> 908         raise exc.ArgumentError(
    909             "Could not parse SQLAlchemy URL from string '%s'" % name
    910         )

ArgumentError: Could not parse SQLAlchemy URL from string 'test.db'

Here's the code I am using:

from premsql.pipelines import SimpleText2SQLAgent
from premsql.generators import Text2SQLGeneratorHF
from premsql.executors import SQLiteExecutor
from langchain_community.utilities.sql_database import SQLDatabase


dsn_or_db_path = "test.db"

agent = SimpleText2SQLAgent(
    dsn_or_db_path=dsn_or_db_path,
    generator=Text2SQLGeneratorHF(
        model_or_name_or_path="premai-io/prem-1B-SQL",
        experiment_name="simple_pipeline",
        device="cuda:0",
        type="test"
    ),
)

amard33p avatar Oct 06 '24 16:10 amard33p

Ahh, I see, is the path of the DB correct? If it is, could you put an issue (having the same code and the error), I would like to check on that.

Anindyadeep avatar Oct 06 '24 20:10 Anindyadeep

Hi, Thank you for the PR, but since there came a major update and the whole pipeline code has been removed with a new module called agents (will release soon). So I am closing this PR. Thanks

Anindyadeep avatar Nov 07 '24 06:11 Anindyadeep