From 0a73dabad2ceaf2bb8ed716c907d889c104abde8 Mon Sep 17 00:00:00 2001 From: dorisjlee Date: Fri, 10 Sep 2021 14:44:26 -0700 Subject: [PATCH] remove examples --- .../GeneralDatabase_Executor_Example.py.ipynb | 138 ---- examples/Lux_Code_Tracing.ipynb | 733 ------------------ examples/mysql_query_template.txt | 19 - examples/postgres_query_template.txt | 19 - examples/query_template.txt | 23 - 5 files changed, 932 deletions(-) delete mode 100644 examples/GeneralDatabase_Executor_Example.py.ipynb delete mode 100644 examples/Lux_Code_Tracing.ipynb delete mode 100644 examples/mysql_query_template.txt delete mode 100644 examples/postgres_query_template.txt delete mode 100644 examples/query_template.txt diff --git a/examples/GeneralDatabase_Executor_Example.py.ipynb b/examples/GeneralDatabase_Executor_Example.py.ipynb deleted file mode 100644 index 5fa57ab5..00000000 --- a/examples/GeneralDatabase_Executor_Example.py.ipynb +++ /dev/null @@ -1,138 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "expected-facility", - "metadata": {}, - "source": [ - "This notebook is an example of how to use the General Database Executor in Lux. This execution backend allows users to switch what kind of queries are being used to query their database system. Here we show how to switch from using a SQL template for Postgresql to MySQL." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "helpful-liberty", - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "97a93a0b783743fab041362d66d72125", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Button(description='Toggle Table/Lux', layout=Layout(bottom='6px', top='6px', width='200px'), style=ButtonStyl…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "e216a8adf9584b6e8a3cc5374ae73209", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "import sys\n", - "sys.path.insert(1, 'C:\\\\Users\\\\thyne\\\\Documents\\\\GitHub\\\\lux')\n", - "\n", - "import lux\n", - "import psycopg2\n", - "import pandas as pd\n", - "from lux import LuxSQLTable\n", - "\n", - "connection = psycopg2.connect(\"host=localhost user=postgres password=lux dbname=postgres\")\n", - "lux.config.set_SQL_connection(connection)\n", - "lux.config.read_query_template(\"postgres_query_template.txt\")\n", - "lux.config.quoted_queries = True\n", - "\n", - "sql_tbl = LuxSQLTable(table_name='car')\n", - "sql_tbl.intent = [\"Cylinders\"]\n", - "sql_tbl" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "searching-nancy", - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "a2c12d8447494178aa6c38fc0a4c59f6", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Button(description='Toggle Table/Lux', layout=Layout(bottom='6px', top='6px', width='200px'), style=ButtonStyl…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "26b23f594155417e9fb7ff2b4695477c", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "import sqlalchemy\n", - "import lux\n", - "from sqlalchemy.ext.declarative import declarative_base\n", - "\n", - "engine = sqlalchemy.create_engine('mysql+mysqlconnector://luxuser:lux@localhost:3306/sys',echo=False)\n", - "lux.config.set_SQL_connection(engine)\n", - "lux.config.read_query_template(\"mysql_query_template.txt\")\n", - "lux.config.quoted_queries = False\n", - "\n", - "sql_df = lux.LuxSQLTable(table_name='car')\n", - "\n", - "sql_df.intent = ['Cylinders']\n", - "sql_df" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "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.9.1" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples/Lux_Code_Tracing.ipynb b/examples/Lux_Code_Tracing.ipynb deleted file mode 100644 index c8b0fc23..00000000 --- a/examples/Lux_Code_Tracing.ipynb +++ /dev/null @@ -1,733 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "experienced-selling", - "metadata": {}, - "outputs": [], - "source": [ - "import sys\n", - "sys.path.insert(1, 'C:\\\\Users\\\\thyne\\\\Documents\\\\GitHub\\\\lux')\n", - "\n", - "import lux\n", - "import pandas as pd" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "neutral-subscriber", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n", - "C:\\Users\\thyne\\Documents\\GitHub\\lux\\lux\\executor\\PandasExecutor.py:372: UserWarning:\n", - "Lux detects that the attribute 'Year' may be temporal.\n", - "To display visualizations for these attributes accurately, please convert temporal attributes to Pandas Datetime objects using the pd.to_datetime function and provide a 'format' parameter to specify the datetime format of the attribute.\n", - "For example, you can convert a year-only attribute (e.g., 1998, 1971, 1982) to Datetime type by specifying the `format` as '%Y'.\n", - "\n", - "Here is a starter template that you can use for converting the temporal fields:\n", - "\tdf['Year'] = pd.to_datetime(df['Year'], format='')\n", - "\n", - "See more at: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html\n", - "If Year is not a temporal attribute, please use override Lux's automatically detected type:\n", - "\tdf.set_data_type({'Year':'quantitative'})\n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "ead29ee7d5f44de6b3fc405f349f0273", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Button(description='Toggle Pandas/Lux', layout=Layout(top='5px', width='140px'), style=ButtonStyle())" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "5c7b1a8091d74855bedc3ac79e92f22b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "url = \"https://github.com/lux-org/lux-datasets/blob/master/data/car.csv?raw=true\"\n", - "my_df = pd.read_csv(url)\n", - "my_df.intent = ['Weight', 'Origin']\n", - "my_df" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "voluntary-emphasis", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "from lux.utils import utils\n", - "from lux.executor.PandasExecutor import PandasExecutor\n", - "import pandas\n", - "import math\n", - "ldf = 'insert your LuxDataFrame variable here'\n", - "vis = 'insert the name of your Vis object here'\n", - "vis._vis_data = ldf\n", - "SAMPLE_FLAG = lux.config.sampling\n", - "SAMPLE_START = lux.config.sampling_start\n", - "SAMPLE_CAP = lux.config.sampling_cap\n", - "SAMPLE_FRAC = 0.75\n", - "ldf._sampled = ldf\n", - "assert (vis.data is not None), \"execute_filter assumes input vis.data is populated (if not, populate with LuxDataFrame values)\"\n", - "filters = utils.get_filter_specs(vis._inferred_intent)\n", - "import numpy as np\n", - "x_attr = vis.get_attr_by_channel(\"x\")[0]\n", - "y_attr = vis.get_attr_by_channel(\"y\")[0]\n", - "has_color = False\n", - "groupby_attr = \"\"\n", - "measure_attr = \"\"\n", - "attr_unique_vals = []\n", - "groupby_attr = y_attr\n", - "measure_attr = x_attr\n", - "agg_func = x_attr.aggregation\n", - "attr_unique_vals = vis.data.unique_values.get(groupby_attr.attribute)\n", - "color_cardinality = 1\n", - " index_name = vis.data.index.name\n", - " index_name = \"index\"\n", - " vis._vis_data = vis.data.reset_index()\n", - " vis._vis_data = (vis.data.groupby(groupby_attr.attribute, dropna=False, history=False).count().reset_index().rename(columns={index_name: \"Record\"}))\n", - " vis._vis_data = vis.data[[groupby_attr.attribute, \"Record\"]]\n", - "result_vals = list(vis.data[groupby_attr.attribute])\n", - "vis._vis_data = vis._vis_data.dropna(subset=[measure_attr.attribute])\n", - " vis._vis_data = vis._vis_data.sort_values(by=groupby_attr.attribute, ascending=True)\n", - "vis._vis_data = vis._vis_data.reset_index()\n", - "vis._vis_data = vis._vis_data.drop(columns=\"index\")\n", - "\n", - "vis\n" - ] - } - ], - "source": [ - "my_vis = my_df.recommendation['Generalize'][0]\n", - "print(my_vis.to_code(language = \"python\"))" - ] - }, - { - "cell_type": "markdown", - "id": "protecting-transcript", - "metadata": {}, - "source": [ - "Once Lux has given us the code used to generate a particular Vis, we can copy and paste the code into a new Jupyter notebook cell. Before running the cell, be sure to populate the `ldf` and `vis` variables with the names of your original LuxDataFrame/LuxSQLTable and Vis objects." - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "surprising-dutch", - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "dbcf9b127b23497992ea6200e673a5f0", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "LuxWidget(current_vis={'config': {'view': {'continuousWidth': 400, 'continuousHeight': 300}, 'axis': {'labelCo…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "from lux.utils import utils\n", - "from lux.executor.PandasExecutor import PandasExecutor\n", - "import pandas\n", - "import math\n", - "ldf = my_df\n", - "vis = my_vis\n", - "vis._vis_data = ldf\n", - "SAMPLE_FLAG = lux.config.sampling\n", - "SAMPLE_START = lux.config.sampling_start\n", - "SAMPLE_CAP = lux.config.sampling_cap\n", - "SAMPLE_FRAC = 0.75\n", - "ldf._sampled = ldf\n", - "assert (vis.data is not None), \"execute_filter assumes input vis.data is populated (if not, populate with LuxDataFrame values)\"\n", - "filters = utils.get_filter_specs(vis._inferred_intent)\n", - "import numpy as np\n", - "x_attr = vis.get_attr_by_channel(\"x\")[0]\n", - "y_attr = vis.get_attr_by_channel(\"y\")[0]\n", - "has_color = False\n", - "groupby_attr = \"\"\n", - "measure_attr = \"\"\n", - "attr_unique_vals = []\n", - "groupby_attr = y_attr\n", - "measure_attr = x_attr\n", - "agg_func = x_attr.aggregation\n", - "attr_unique_vals = vis.data.unique_values.get(groupby_attr.attribute)\n", - "color_cardinality = 1\n", - "index_name = vis.data.index.name\n", - "index_name = \"index\"\n", - "vis._vis_data = vis.data.reset_index()\n", - "vis._vis_data = (vis.data.groupby(groupby_attr.attribute, dropna=False, history=False).count().reset_index().rename(columns={index_name: \"Record\"}))\n", - "vis._vis_data = vis.data[[groupby_attr.attribute, \"Record\"]]\n", - "result_vals = list(vis.data[groupby_attr.attribute])\n", - "vis._vis_data = vis._vis_data.dropna(subset=[measure_attr.attribute])\n", - "vis._vis_data = vis._vis_data.sort_values(by=groupby_attr.attribute, ascending=True)\n", - "vis._vis_data = vis._vis_data.reset_index()\n", - "vis._vis_data = vis._vis_data.drop(columns=\"index\")\n", - "\n", - "vis" - ] - }, - { - "cell_type": "markdown", - "id": "vulnerable-trade", - "metadata": {}, - "source": [ - "The code tracing also works when using the SQLExecutor. You can also access the specific SQL query used by the executor by specifying `language = 'SQL'` in the `to_code()` function." - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "unsigned-balance", - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "a3cf748eae1649be8f6a43a5f6365699", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Button(description='Toggle Table/Lux', layout=Layout(bottom='6px', top='6px', width='200px'), style=ButtonStyl…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "dbbcf0f06b0445b5860f037d8a093ee4", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Output()" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "import psycopg2\n", - "from lux import LuxSQLTable\n", - "\n", - "connection = psycopg2.connect(\"host=localhost user=postgres password=lux dbname=postgres\")\n", - "lux.config.set_SQL_connection(connection)\n", - "lux.config.set_executor_type(\"SQL\")\n", - "\n", - "sql_tbl = LuxSQLTable(table_name='car')\n", - "sql_tbl.intent = [\"Cylinders\"]\n", - "sql_tbl" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "identified-replica", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'SQLExecutor'" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "lux.config.executor.name" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "typical-exemption", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "SELECT \"Year\", \"Cylinders\", COUNT(\"Year\") FROM car WHERE \"Year\" IS NOT NULL AND \"Cylinders\" IS NOT NULL GROUP BY \"Year\", \"Cylinders\"\n", - "None\n" - ] - } - ], - "source": [ - "my_vis = sql_tbl.recommendation['Enhance'][0]\n", - "print(print(my_vis.to_code(language = \"SQL\")))" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "likely-choice", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "from lux.utils import utils\n", - "from lux.executor.SQLExecutor import SQLExecutor\n", - "import pandas\n", - "import math\n", - "tbl = 'insert your LuxSQLTable variable here'\n", - "view = 'insert the name of your Vis object here'\n", - "x_attr = view.get_attr_by_channel(\"x\")[0]\n", - "y_attr = view.get_attr_by_channel(\"y\")[0]\n", - "has_color = False\n", - "groupby_attr = \"\"\n", - "measure_attr = \"\"\n", - "groupby_attr = x_attr\n", - "measure_attr = y_attr\n", - "agg_func = y_attr.aggregation\n", - "attr_unique_vals = tbl.unique_values[groupby_attr.attribute]\n", - "color_attr = view.get_attr_by_channel(\"color\")[0]\n", - "color_attr_vals = tbl.unique_values[color_attr.attribute]\n", - "color_cardinality = len(color_attr_vals)\n", - "has_color = True\n", - " where_clause, filterVars = SQLExecutor.execute_filter(view)\n", - "filters = utils.get_filter_specs(view._inferred_intent)\n", - " length_query = pandas.read_sql(\"SELECT COUNT(*) as length FROM {} {}\".format(tbl.table_name, where_clause),lux.config.SQLconnection,)\n", - " count_query = 'SELECT \"{}\", \"{}\", COUNT(\"{}\") FROM {} {} GROUP BY \"{}\", \"{}\"'.format(groupby_attr.attribute,color_attr.attribute,groupby_attr.attribute,tbl.table_name,where_clause,groupby_attr.attribute,color_attr.attribute,)\n", - " view._vis_data = pandas.read_sql(count_query, lux.config.SQLconnection)\n", - " view._vis_data = view._vis_data.rename(columns={\"count\": \"Record\"})\n", - " view._vis_data = utils.pandas_to_lux(view._vis_data)\n", - " view._query = count_query\n", - "result_vals = list(view._vis_data[groupby_attr.attribute])\n", - " res_color_combi_vals = []\n", - " result_color_vals = list(view._vis_data[color_attr.attribute])\n", - " for i in range(0, len(result_vals)):\n", - " res_color_combi_vals.append([result_vals[i], result_color_vals[i]])\n", - " N_unique_vals = len(attr_unique_vals)\n", - " columns = view._vis_data.columns\n", - " df = pandas.DataFrame({columns[0]: attr_unique_vals * color_cardinality,columns[1]: pandas.Series(color_attr_vals).repeat(N_unique_vals),})\n", - " view._vis_data = view._vis_data.merge(df,on=[columns[0], columns[1]],how=\"right\",suffixes=[\"\", \"_right\"],)\n", - " for col in columns[2:]:\n", - " view._vis_data[col] = view._vis_data[col].fillna(0) # Triggers __setitem__\n", - " assert len(list(view._vis_data[groupby_attr.attribute])) == N_unique_vals * len(color_attr_vals), f\"Aggregated data missing values compared to original range of values of `{groupby_attr.attribute, color_attr.attribute}`.\"\n", - " view._vis_data = view._vis_data.iloc[:, :3] # Keep only the three relevant columns not the *_right columns resulting from merge\n", - "view._vis_data = view._vis_data.sort_values(by=groupby_attr.attribute, ascending=True)\n", - "view._vis_data = view._vis_data.reset_index()\n", - "view._vis_data = view._vis_data.drop(columns=\"index\")\n", - "\n", - "view\n" - ] - } - ], - "source": [ - "print(my_vis.to_code(language = \"python\"))" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "running-laser", - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "a901329aa3dc46d4a642b7c6838c2879", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "LuxWidget(current_vis={'config': {'view': {'continuousWidth': 400, 'continuousHeight': 300}, 'axis': {'labelCo…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "from lux.utils import utils\n", - "from lux.executor.SQLExecutor import SQLExecutor\n", - "import pandas\n", - "import math\n", - "tbl = sql_tbl\n", - "view = my_vis\n", - "x_attr = view.get_attr_by_channel(\"x\")[0]\n", - "y_attr = view.get_attr_by_channel(\"y\")[0]\n", - "has_color = False\n", - "groupby_attr = \"\"\n", - "measure_attr = \"\"\n", - "groupby_attr = x_attr\n", - "measure_attr = y_attr\n", - "agg_func = y_attr.aggregation\n", - "attr_unique_vals = tbl.unique_values[groupby_attr.attribute]\n", - "color_attr = view.get_attr_by_channel(\"color\")[0]\n", - "color_attr_vals = tbl.unique_values[color_attr.attribute]\n", - "color_cardinality = len(color_attr_vals)\n", - "has_color = True\n", - "where_clause, filterVars = SQLExecutor.execute_filter(view)\n", - "filters = utils.get_filter_specs(view._inferred_intent)\n", - "length_query = pandas.read_sql(\"SELECT COUNT(*) as length FROM {} {}\".format(tbl.table_name, where_clause),lux.config.SQLconnection,)\n", - "count_query = 'SELECT \"{}\", \"{}\", COUNT(\"{}\") FROM {} {} GROUP BY \"{}\", \"{}\"'.format(groupby_attr.attribute,color_attr.attribute,groupby_attr.attribute,tbl.table_name,where_clause,groupby_attr.attribute,color_attr.attribute,)\n", - "view._vis_data = pandas.read_sql(count_query, lux.config.SQLconnection)\n", - "view._vis_data = view._vis_data.rename(columns={\"count\": \"Record\"})\n", - "view._vis_data = utils.pandas_to_lux(view._vis_data)\n", - "view._query = count_query\n", - "result_vals = list(view._vis_data[groupby_attr.attribute])\n", - "res_color_combi_vals = []\n", - "result_color_vals = list(view._vis_data[color_attr.attribute])\n", - "for i in range(0, len(result_vals)):\n", - " res_color_combi_vals.append([result_vals[i], result_color_vals[i]])\n", - "N_unique_vals = len(attr_unique_vals)\n", - "columns = view._vis_data.columns\n", - "df = pandas.DataFrame({columns[0]: attr_unique_vals * color_cardinality,columns[1]: pandas.Series(color_attr_vals).repeat(N_unique_vals),})\n", - "view._vis_data = view._vis_data.merge(df,on=[columns[0], columns[1]],how=\"right\",suffixes=[\"\", \"_right\"],)\n", - "for col in columns[2:]:\n", - " view._vis_data[col] = view._vis_data[col].fillna(0) # Triggers __setitem__\n", - "assert len(list(view._vis_data[groupby_attr.attribute])) == N_unique_vals * len(color_attr_vals), f\"Aggregated data missing values compared to original range of values of `{groupby_attr.attribute, color_attr.attribute}`.\"\n", - "view._vis_data = view._vis_data.iloc[:, :3] # Keep only the three relevant columns not the *_right columns resulting from merge\n", - "view._vis_data = view._vis_data.sort_values(by=groupby_attr.attribute, ascending=True)\n", - "view._vis_data = view._vis_data.reset_index()\n", - "view._vis_data = view._vis_data.drop(columns=\"index\")\n", - "\n", - "view" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "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.9.1" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples/mysql_query_template.txt b/examples/mysql_query_template.txt deleted file mode 100644 index b70be61e..00000000 --- a/examples/mysql_query_template.txt +++ /dev/null @@ -1,19 +0,0 @@ -preview_query:SELECT * from {table_name} LIMIT {num_rows} -length_query:SELECT COUNT(*) as length FROM {table_name} {where_clause} -sample_query:SELECT * FROM {table_name} {where_clause} LIMIT {num_rows} -scatter_query:SELECT {columns} FROM {table_name} {where_clause} -colored_barchart_counts:SELECT {groupby_attr}, {color_attr}, COUNT({groupby_attr}) as count FROM {table_name} {where_clause} GROUP BY {groupby_attr}, {color_attr} -colored_barchart_average:SELECT {groupby_attr}, {color_attr}, AVG({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr}, {color_attr} -colored_barchart_sum:SELECT {groupby_attr}, {color_attr}, SUM({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr}, {color_attr} -colored_barchart_max:SELECT {groupby_attr}, {color_attr}, MAX({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr}, {color_attr} -barchart_counts:SELECT {groupby_attr}, COUNT({groupby_attr}) as count FROM {table_name} {where_clause} GROUP BY {groupby_attr} -barchart_average:SELECT {groupby_attr}, AVG({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr} -barchart_sum:SELECT {groupby_attr}, SUM({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr} -barchart_max:SELECT {groupby_attr}, MAX({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr} -histogram_counts:SELECT width_bucket, count(width_bucket) as count from (SELECT ({bucket_cases}) as width_bucket from {table_name} {where_clause}) as buckets GROUP BY width_bucket order by width_bucket -heatmap_counts:SELECT width_bucket1, width_bucket2, count(*) as count FROM (SELECT ({bucket_cases1}) as width_bucket1, ({bucket_cases2}) as width_bucket2 FROM {table_name} {where_clause}) as labeled_data GROUP BY width_bucket1, width_bucket2 -table_attributes_query:SELECT COLUMN_NAME as column_name FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '{table_name}' -min_max_query:SELECT MIN({attribute}) as min, MAX({attribute}) as max FROM {table_name} -cardinality_query:SELECT COUNT(Distinct({attribute})) as count FROM {table_name} WHERE {attribute} IS NOT NULL -unique_query:SELECT Distinct({attribute}) FROM {table_name} WHERE {attribute} IS NOT NULL -datatype_query:SELECT DATA_TYPE as data_type FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '{table_name}' AND COLUMN_NAME = '{attribute}' \ No newline at end of file diff --git a/examples/postgres_query_template.txt b/examples/postgres_query_template.txt deleted file mode 100644 index f004a169..00000000 --- a/examples/postgres_query_template.txt +++ /dev/null @@ -1,19 +0,0 @@ -preview_query:SELECT * from {table_name} LIMIT {num_rows} -length_query:SELECT COUNT(1) as length FROM {table_name} {where_clause} -sample_query:SELECT * FROM {table_name} {where_clause} ORDER BY random() LIMIT {num_rows} -scatter_query:SELECT {columns} FROM {table_name} {where_clause} -colored_barchart_counts:SELECT "{groupby_attr}", "{color_attr}", COUNT("{groupby_attr}") FROM {table_name} {where_clause} GROUP BY "{groupby_attr}", "{color_attr}" -colored_barchart_average:SELECT "{groupby_attr}", "{color_attr}", AVG("{measure_attr}") as "{measure_attr}" FROM {table_name} {where_clause} GROUP BY "{groupby_attr}", "{color_attr}" -colored_barchart_sum:SELECT "{groupby_attr}", "{color_attr}", SUM("{measure_attr}") as "{measure_attr}" FROM {table_name} {where_clause} GROUP BY "{groupby_attr}", "{color_attr}" -colored_barchart_max:SELECT "{groupby_attr}", "{color_attr}", MAX("{measure_attr}") as "{measure_attr}" FROM {table_name} {where_clause} GROUP BY "{groupby_attr}", "{color_attr}" -barchart_counts:SELECT "{groupby_attr}", COUNT("{groupby_attr}") FROM {table_name} {where_clause} GROUP BY "{groupby_attr}" -barchart_average:SELECT "{groupby_attr}", AVG("{measure_attr}") as "{measure_attr}" FROM {table_name} {where_clause} GROUP BY "{groupby_attr}" -barchart_sum:SELECT "{groupby_attr}", SUM("{measure_attr}") as "{measure_attr}" FROM {table_name} {where_clause} GROUP BY "{groupby_attr}" -barchart_max:SELECT "{groupby_attr}", MAX("{measure_attr}") as "{measure_attr}" FROM {table_name} {where_clause} GROUP BY "{groupby_attr}" -histogram_counts:SELECT width_bucket, COUNT(width_bucket) FROM (SELECT width_bucket(CAST ("{bin_attribute}" AS FLOAT), '{upper_edges}') FROM {table_name} {where_clause}) as Buckets GROUP BY width_bucket ORDER BY width_bucket -heatmap_counts:SELECT width_bucket1, width_bucket2, count(*) FROM (SELECT width_bucket(CAST ("{x_attribute}" AS FLOAT), '{x_upper_edges_string}') as width_bucket1, width_bucket(CAST ("{y_attribute}" AS FLOAT), '{y_upper_edges_string}') as width_bucket2 FROM {table_name} {where_clause}) as foo GROUP BY width_bucket1, width_bucket2 -table_attributes_query:SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '{table_name}' -min_max_query:SELECT MIN("{attribute}") as min, MAX("{attribute}") as max FROM {table_name} -cardinality_query:SELECT Count(Distinct("{attribute}")) FROM {table_name} WHERE "{attribute}" IS NOT NULL -unique_query:SELECT Distinct("{attribute}") FROM {table_name} WHERE "{attribute}" IS NOT NULL -datatype_query:SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '{table_name}' AND COLUMN_NAME = '{attribute}' \ No newline at end of file diff --git a/examples/query_template.txt b/examples/query_template.txt deleted file mode 100644 index c04c746a..00000000 --- a/examples/query_template.txt +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################## -#########################Example Query Template ######################### -# Details on query function see: https://readthedocs... ## -############################################################################## -preview_query: -length_query: -sample_query: -scatter_query: -colored_barchart_counts:SELECT {groupby_attr}, {color_attr}, COUNT({groupby_attr}) as count FROM {table_name} {where_clause} GROUP BY {groupby_attr}, {color_attr} -colored_barchart_average:SELECT {groupby_attr}, {color_attr}, AVG({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr}, {color_attr} -colored_barchart_sum:SELECT {groupby_attr}, {color_attr}, SUM({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr}, {color_attr} -colored_barchart_max:SELECT {groupby_attr}, {color_attr}, MAX({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr}, {color_attr} -barchart_counts:SELECT {groupby_attr}, COUNT({groupby_attr}) as count FROM {table_name} {where_clause} GROUP BY {groupby_attr} -barchart_average:SELECT {groupby_attr}, AVG({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr} -barchart_sum:SELECT {groupby_attr}, SUM({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr} -barchart_max:SELECT {groupby_attr}, MAX({measure_attr}) as {measure_attr} FROM {table_name} {where_clause} GROUP BY {groupby_attr} -histogram_counts:SELECT width_bucket, count(width_bucket) as count from (SELECT ({bucket_cases}) as width_bucket from {table_name} {where_clause}) as buckets GROUP BY width_bucket order by width_bucket -heatmap_counts:SELECT width_bucket1, width_bucket2, count(*) as count FROM (SELECT ({bucket_cases1}) as width_bucket1, ({bucket_cases2}) as width_bucket2 FROM {table_name} {where_clause}) as labeled_data GROUP BY width_bucket1, width_bucket2 -table_attributes_query:SELECT COLUMN_NAME as column_name FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '{table_name}' -min_max_query:SELECT MIN({attribute}) as min, MAX({attribute}) as max FROM {table_name} -cardinality_query:SELECT COUNT(Distinct({attribute})) as count FROM {table_name} WHERE {attribute} IS NOT NULL -unique_query:SELECT Distinct({attribute}) FROM {table_name} WHERE {attribute} IS NOT NULL -datatype_query:SELECT DATA_TYPE as data_type FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '{table_name}' AND COLUMN_NAME = '{attribute}' \ No newline at end of file