Metadata-Version: 2.4
Name: sqlalchemy_altibase7
Version: 0.0.4
Summary: Altibase for SQLAlchemy
Author-email: Hess Lee <hess.lee7@gmail.com>
License: MIT
Project-URL: Source Code, https://github.com/hesslee/sqlalchemy-altibase7
Keywords: SQLAlchemy Altibase
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Database :: Front-Ends
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: odbcinst
Requires-Dist: pyodbc
Requires-Dist: sqlalchemy>=1.3.24
Provides-Extra: lint
Requires-Dist: black; extra == "lint"
Requires-Dist: flake8; extra == "lint"
Requires-Dist: mypy; extra == "lint"
Requires-Dist: isort; extra == "lint"
Requires-Dist: pre-commit; extra == "lint"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov[all]; extra == "test"

# sqlalchemy-altibase7
- Altibase support for SQLAlchemy implemented as an external dialect.
- It is tested on Altibase v7.
- This source code is based on https://pypi.org/project/sqlalchemy-altibase .
- This package itself is uploaded on https://pypi.org/project/sqlalchemy-altibase7 .

# Changes from sqlalchemy-altibase
- It is mainly supplemented for langchain connectivity.
- sqlalchemy version upper limit requirement is removed.

# Prereqisite
- unixodbc
- pyodbc

## unixodbc
- install : sudo apt-get install unixodbc-dev
- example configuration :
```
$ cat /etc/odbc.ini 
[PYODBC]
Driver          = /home/hess/work/altidev4/altibase_home/lib/libaltibase_odbc-64bit-ul64.so
Database        = mydb
ServerType      = Altibase
Server          = 127.0.0.1
Port            = 21121
UserName        = SYS
Password        = MANAGER
FetchBuffersize = 64
ReadOnly        = no

$ cat /etc/odbcinst.ini 
[ODBC]
Trace=Yes
TraceFile=/tmp/odbc_trace.log
```

## pyodbc
- install : pip install pyodbc
- test :
```
$ python
>>> import pyodbc
>>> conn = pyodbc.connect('DSN=PYODBC')
>>> curs = conn.cursor()
>>> curs.execute("select * from v$table")
>>> curs.fetchall()
```

# sqlalchemy-altibase7 using langchain
- install : pip install sqlalchemy-altibase7
- reference : https://python.langchain.com/v0.1/docs/use_cases/sql/
- test preparation : Populate sample data into Altibase database using "test/Chinook_Altibase.sql" file in this repository.
- test programs
  - langchain_chain.py : using chain
    - reference : https://python.langchain.com/v0.1/docs/use_cases/sql/quickstart/#chain
  - langchain_agent.py : using sql agent
    - reference : https://python.langchain.com/v0.1/docs/use_cases/sql/agents/#agent
  - langchain_agent_fewshot.py : using sql agent with few shot prompt
    - reference : https://python.langchain.com/v0.1/docs/use_cases/sql/agents/#using-a-dynamic-few-shot-prompt
  - langchain_agent_retriever.py : using sql agent with retriever for correcting invalid nouns
    - reference : https://python.langchain.com/v0.1/docs/use_cases/sql/agents/#dealing-with-high-cardinality-columns


