{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import sqlite3\n", "import pandas as pd\n", "from pyprojroot import here" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Connect to SQLite database\n", "db_path = here('data/travel.sqlite')\n", "conn = sqlite3.connect(db_path)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
name
0aircrafts_data
1airports_data
2boarding_passes
3bookings
4flights
5seats
6ticket_flights
7tickets
8car_rentals
9hotels
10trip_recommendations
\n", "
" ], "text/plain": [ " name\n", "0 aircrafts_data\n", "1 airports_data\n", "2 boarding_passes\n", "3 bookings\n", "4 flights\n", "5 seats\n", "6 ticket_flights\n", "7 tickets\n", "8 car_rentals\n", "9 hotels\n", "10 trip_recommendations" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Get list of all tables\n", "query = \"SELECT name FROM sqlite_master WHERE type='table';\"\n", "tables = pd.read_sql(query, conn)\n", "tables" ] } ], "metadata": { "kernelspec": { "display_name": "rag-sqlagent", "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.11.9" } }, "nbformat": 4, "nbformat_minor": 2 }