This project is no longer actively maintained. Feel free to adapt the code to your own use-case.
Thin high level client to use when consuming data through the Denodo proprietory ODBC driver.
This project is not in any way associated with Denodo.
- Free software: MIT license
- ODBC cursor low-level access to Denodo with sensible default connection string
- High-level client using Pandas to fetch results to a dataframe, all in one go or chunkwise
- Simple query templating functionality
Requires python 3.8 or higher.
pip install denodoclient pandas
from denodoclient.dataframes import DenodoDataFrameClient
from denodoclient import VqlQuery
from pathlib import Path
client = DenodoDataFrameClient("database_name")
vqlquery = VqlQuery(Path("examples/template.sql"))
df = client.query(vqlquery).to_dataframe()
from denodoclient import DenodoClient
from denodoclient import VqlQuery
from pathlib import Path
client = DenodoClient("database_name")
vqlquery = VqlQuery(Path("examples/template.sql"))
cursor = client.query(vqlquery).cursor
# Do whatever you want with the pyodbc cursor
Default server is denodo
and default ODBC driver name is DenodoODBC Unicode(x64)
. You can change
this by passing parameters in as follows.
from denodoclient import DenodoClient
from denodoclient import VqlQuery
from pathlib import Path
client = DenodoClient("database_name", DRIVER="my_denodo_driver", SERVER="denodo-uat")
For a list of options, have a look at DenodoClient.OPTIONS
.
print(DenodoClient.OPTIONS)
You can just set parameters on the query object, or in the constructor.
SELECT * FROM table WHERE name = "{foo}";
from denodoclient import VqlQuery
from pathlib import Path
vqlquery = VqlQuery(Path("examples/template.sql"), foo="John")
vqlquery.foo = "Mark"
# You can set any variable you want
vqlquery.baz = "Foobaz!"
# See a list of the currently set variables
print(vqlquery.tokens)
# See the string representation of the query
print(str(vqlquery))
Please be aware that the templating functionality in this package is vulnerable to SQL-injection attacks. Use with caution.
This package was created at DFDS.
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
If you find bugs or have a feature request, please file an issue.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.