Files
langchain/docs/versioned_docs/version-0.2.x/integrations/document_loaders/athena.ipynb
Jacob Lee aff771923a Jacob/new docs (#20570)
Use docusaurus versioning with a callout, merged master as well

@hwchase17 @baskaryan

---------

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Rahul Tripathi <rauhl.psit.ec@gmail.com>
Co-authored-by: Leonid Ganeline <leo.gan.57@gmail.com>
Co-authored-by: Leonid Kuligin <lkuligin@yandex.ru>
Co-authored-by: Averi Kitsch <akitsch@google.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
Co-authored-by: Nuno Campos <nuno@langchain.dev>
Co-authored-by: Nuno Campos <nuno@boringbits.io>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
Co-authored-by: Martín Gotelli Ferenaz <martingotelliferenaz@gmail.com>
Co-authored-by: Fayfox <admin@fayfox.com>
Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
Co-authored-by: Dawson Bauer <105886620+djbauer2@users.noreply.github.com>
Co-authored-by: Ravindu Somawansa <ravindu.somawansa@gmail.com>
Co-authored-by: Dhruv Chawla <43818888+Dominastorm@users.noreply.github.com>
Co-authored-by: ccurme <chester.curme@gmail.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: WeichenXu <weichen.xu@databricks.com>
Co-authored-by: Benito Geordie <89472452+benitoThree@users.noreply.github.com>
Co-authored-by: kartikTAI <129414343+kartikTAI@users.noreply.github.com>
Co-authored-by: Kartik Sarangmath <kartik@thirdai.com>
Co-authored-by: Sevin F. Varoglu <sfvaroglu@octoml.ai>
Co-authored-by: MacanPN <martin.triska@gmail.com>
Co-authored-by: Prashanth Rao <35005448+prrao87@users.noreply.github.com>
Co-authored-by: Hyeongchan Kim <kozistr@gmail.com>
Co-authored-by: sdan <git@sdan.io>
Co-authored-by: Guangdong Liu <liugddx@gmail.com>
Co-authored-by: Rahul Triptahi <rahul.psit.ec@gmail.com>
Co-authored-by: Rahul Tripathi <rauhl.psit.ec@gmail.com>
Co-authored-by: pjb157 <84070455+pjb157@users.noreply.github.com>
Co-authored-by: Eun Hye Kim <ehkim1440@gmail.com>
Co-authored-by: kaijietti <43436010+kaijietti@users.noreply.github.com>
Co-authored-by: Pengcheng Liu <pcliu.fd@gmail.com>
Co-authored-by: Tomer Cagan <tomer@tomercagan.com>
Co-authored-by: Christophe Bornet <cbornet@hotmail.com>
2024-04-18 11:10:55 -07:00

146 lines
3.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "MwTWzDxYgbrR"
},
"source": [
"# Athena\n",
"\n",
">[Amazon Athena](https://aws.amazon.com/athena/) is a serverless, interactive analytics service built\n",
">on open-source frameworks, supporting open-table and file formats. `Athena` provides a simplified,\n",
">flexible way to analyze petabytes of data where it lives. Analyze data or build applications\n",
">from an Amazon Simple Storage Service (S3) data lake and 30 data sources, including on-premises data\n",
">sources or other cloud systems using SQL or Python. `Athena` is built on open-source `Trino`\n",
">and `Presto` engines and `Apache Spark` frameworks, with no provisioning or configuration effort required.\n",
"\n",
"This notebook goes over how to load documents from `AWS Athena`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setting up\n",
"\n",
"Follow [instructions to set up an AWS accoung](https://docs.aws.amazon.com/athena/latest/ug/setting-up.html).\n",
"\n",
"Install a python library:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "F0zaLR3xgWmO"
},
"outputs": [],
"source": [
"! pip install boto3"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "076NLjfngoWJ"
},
"outputs": [],
"source": [
"from langchain_community.document_loaders.athena import AthenaLoader"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "XpMRQwU9gu44"
},
"outputs": [],
"source": [
"database_name = \"my_database\"\n",
"s3_output_path = \"s3://my_bucket/query_results/\"\n",
"query = \"SELECT * FROM my_table\"\n",
"profile_name = \"my_profile\"\n",
"\n",
"loader = AthenaLoader(\n",
" query=query,\n",
" database=database_name,\n",
" s3_output_uri=s3_output_path,\n",
" profile_name=profile_name,\n",
")\n",
"\n",
"documents = loader.load()\n",
"print(documents)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5IBapL3ejoEt"
},
"source": [
"Example with metadata columns"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "wMx6nI1qjryD"
},
"outputs": [],
"source": [
"database_name = \"my_database\"\n",
"s3_output_path = \"s3://my_bucket/query_results/\"\n",
"query = \"SELECT * FROM my_table\"\n",
"profile_name = \"my_profile\"\n",
"metadata_columns = [\"_row\", \"_created_at\"]\n",
"\n",
"loader = AthenaLoader(\n",
" query=query,\n",
" database=database_name,\n",
" s3_output_uri=s3_output_path,\n",
" profile_name=profile_name,\n",
" metadata_columns=metadata_columns,\n",
")\n",
"\n",
"documents = loader.load()\n",
"print(documents)"
]
}
],
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 4
}