Skip to content

Commit

Permalink
Update to SQLExecutor and Visualization Code Exporting (#388)
Browse files Browse the repository at this point in the history
* Parameter Bug Fix

Lux DataFrame current_vis should be an empty list after recs are expired.

Executor name for small_df and very_small_df checks should be "PandasExecutor"

* Reference Fix in Warning

Executor check here should look for name "PandasExecutor"

* Black Formatting

* Black formatting

* Fix Executor Reference

Update current_vis() to reference lux.config.executor

* Update frame.py

* Moved set functions to global config

* Cleaned up executor imports, Fixed issue in AltairRenderer

Issue where Altair Renderer was not using lux.config.executor

* Black formatting

* Merged changes from Master branch, Moved Executor Parameters to Config (#163)

* Merging Recent SQL Executor changes

* Fix to Validator

Uses unique value metadata to verify if a value is valid

* Fix Bug with Widget Rendering

frame.py was trying to import luxWidget instead of luxwidget

* Added Number of Observations to MetaData, Fixed Interestingness issue with SQL Executor

Some interestingness functions required the number of observations in the data and visualization, so I added these values to the metadata to make the scoring work when using the SQL executor

Added tests for SQL executor

* Re-added Licensing Headers

* Adding Recent frame.py changes

* Adjusted SQL Executor Tests

Removed lines that changed Year column type to datetime

* Update Frame with new Action Registering

* Resolving Conflicts in frame.py

* Commenting out local SQL Executor tests

SQL Executor tests interfering with travis build, commenting out for now

* Update correlation.py

* Update frame.py

* bugfix: "number of remaining bars" text overcounts for colored bar charts
* update number of bars calculation to account for when len(data) double counts

* Fixing Code Format

* Cleaning up Pandas Executor imports

* Fix Validation Bug

Issue where validator was relying on metadata which was not yet generated, moved metadata calculation before validation step in frame.py

* Changed metadata variable name

Renamed num_obs to length, removed ordinal variable from Executor mapping function

* Adding support for setting intent on front end (#112)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* Make default_display a global setting (#121)

* remove and register action functions

* update changes inframe.py

* update changes inframe.py

* add documentation and changes

* indentation and comments

* new line

* globally defined default display works with warning

* no examples

* add back space

* new line

* uncomment docstring

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>

* Added script to generate Postgresql database

Updated travis.yml file to create postgresql database in test instance.

Added script to populate test database with data.

* Update upload_car_data.py

Updated database credentials

* Updated script name in travis.yml

* Removed unnecessary import from travis.yml

* Added psycopg2 to requirements.txt

* Creating Postgres test database in travis

* Fixed directory issue

* Updated SQL Executor Tests

Added tests for basic SQL Executor functionality.

* Update requirements.txt (#128)

* basic scatterplot experiments

* experiment results with manually binned heatmaps

* experiment result

* incorporated heatmap code into executor and renderer

* additional experiments to evaluate scatter v.s. heatmap performance

* experiment based on real estate and airbnb data

* modified general sampling criteria, suppress SettingWithCopyWarning stemming from groupby .agg (#93)

* decrease sampling parameter

* change sampling strategy (above threshold keep 3/4 of data)

* remove experiment dir

* modified performance param

* enforce lux-widget minimum version

* update requirement.txt

* separate dev and install requirements

* replaced _exportedVisIdxs --> _selectedVisIdxs

* bugfix: plot config error when current_vis is None

* Added sql_executor example notebook, minor bug fix

Added an example notebook to showcase how to use the sql-engine.

Fixed variable reference in interestingness.py that was causing issues.

* Add LuxSeries Implementation (#122)

* add preliminary groupby fixes

* preliminary LuxSeries implementation

* add tests for new Series implementation

* clean up the added code

* minor code changes

* fix issues with Vis with index

* small fixes

* remove comments

* bugfix column group display empty Vis involving groupby index

* bugfix Cylinders not showing up as bar charts

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* add black to travis (#127)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version

* remove dev dependencies

* fix doc failing from black format

* Cleaned SQL Executor Example Notebook

restarted kernel and cleared output

* Update custom action reference to executor

Now uses executor tied to the dataframe for execution

* Updated Interestingness Tests (#133)

* add black

* update cars dataset and tests

* Delete old dataset

* Updated Interestingness Tests

Updated tests to use the newly updated cars dataset

* switch to local cars reference

Co-authored-by: Kunal Agarwal <kagarwal2@berkeley.edu>
Co-authored-by: Kunal Agarwal <32151899+westernguy2@users.noreply.github.com>
Co-authored-by: 19thyneb <thyne.boonmark@gmail.com>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* fix broken link in docs

* Updated Tests, Added benchmarking for SQL Executor

Updated Compiler and Interestingness tests to work for SQL executor.

Updated SQL Executor to have some benchmarking code for tracking query performance.

* Merge with upstream branch, added preliminary benchmarking code

* Better warning message for Vis and VisList (#135)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* adding warning message for Vis intents being > 1

* passes tests and intent < 3

* minor change to error message, added test

* run black

* accounted for more edge cases and hid traceback

* fixed typo

* added tests

* format w/ black

* ran black again

* Update Vis.py

minor readability changes

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Pandas rewrite Performance optimizations  (#136)

* basic scatterplot experiments

* experiment results with manually binned heatmaps

* experiment result

* incorporated heatmap code into executor and renderer

* additional experiments to evaluate scatter v.s. heatmap performance

* experiment based on real estate and airbnb data

* modified general sampling criteria, suppress SettingWithCopyWarning stemming from groupby .agg (#93)

* decrease sampling parameter

* change sampling strategy (above threshold keep 3/4 of data)

* remove experiment dir

* modified performance param

* enforce lux-widget minimum version

* update requirement.txt

* testing out modin (Recursion error)

* create modin executor, all else in sync with master changes

* rewrote .loc with column reference, speed up by 100x

* replace agg("count") with .count() --> ~0.1ms speedup

* run black

* Added 2D Binning functionality to SQL Executor

added 2D binning to replace scatterplots when using SQL executor.

* Update README.md

update slack link

* Updated temporal detection and tests (#139)

* Updated temporal detection and tests

* Reformatted code with black

* Update PandasExecutor.py

* added stock date test

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Fix Inline comments breaking to new lines (#137)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version

* remove dev dependencies

* first pass -- inline comments

* _config/config.py

* delete test notebook

* action

* line length 105

* executor

* interestingness

* processor

* vislib

* tests, travis, CONTRIBUTING

* .format
() changed

* replace tabs with escape chars

* update using black

* more rewrites and merges into single line

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Improve warning message when values specified as attributes (#143)

* Improve warning message when values specified as attributes (#142)

* added test, ran black

* bugfix test

* Better warning message for Vis and VisList (#146)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* adding warning message for Vis intents being > 1

* passes tests and intent < 3

* minor change to error message, added test

* run black

* accounted for more edge cases and hid traceback

* fixed typo

* added tests

* format w/ black

* ran black again

* Update Vis.py

minor readability changes

* added check and tests for Vis list and | syntax

* ran black

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Updated docs for JupyterLab (#148)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* updated install and faq

* added install_lab.sh script

* Global shared variable in test (#144) (#149)

* using global shared variable in test (lux-org#144)

* modified fixture scope as session, resolved dependency test cases

* run black

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Updated 2D Binning Functionality

Interestingness function now compatible with 2D binning with SQL Executor. Fixed issue where some datapoints in heatmap data were of string type instead of integer.

* documentation for custom actions (#134)

* documentation for custom actions

* fix config tests

* fix documentaion links

* Add default display Config Class documentation

* delete hpi

* doc resolved changes

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Patch failing test (#134)

* Patch failing test (#134)

* Patch failing test (#134)

* Added Heatmap generation to SQL Executor, Bug fix in PandasExecutor

Added 2D Binning function to collect data for heatmaps in the SQL Executor and updated compiler test to reflect heatmap changes in SQL Executor

Fixed issue within PandasExecutor where 2D binning function would not color heatmap using temporal variables

* Updated Code Formatting with Black

* Update Requirements to include psycopg2

* Update upload_car_data.py

Updated to use newest car.csv file

* Update Compiler tests to use correct test DB

* Removed Benchmarking Code

* Fixing Black Formatting

* Add Toggle button for LuxSeries (#153)

* add black

* add groupby to history

* add LuxSeries visualization implementation

* remove groupby extending

* run black

* merge master into branch

* run black

* Reformat Warnings Labels (#151)

* add format for warnings

* fix small details

* globally defined lux

* fix formatting

* Delete similarity.py

* Rename similarity_old.py to similarity.py

* fix commit

* update master with changes to warning labels

* fix formatting

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>

* Make plot_config a global variable (#152)

* plot_config made global config

* docs and tests updates; black formatting

* Delete Untitled.ipynb

* cleanup

* remove data encapsulation

* black formatting

* Update style.rst

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Patch documentation (#134)

* code cleanup
* making LuxDataFrame pickle-able
* various simplification and rewrite to Compiler and Vis
* changing `render_VSpec` to `to_code`
* bugfix in filter (list comprehension lazily evaluated)

* Moved Executor Parameters to Global Config

* Black formatting

* Fix issue with read_json and add tests for different file types (#156)

* fix read_json bug and add tests

* convert tests to reference lux-datasets

* run black

* remove comments

* Update __init__.py

* Update test_pandas_coverage.py

new_df --> df

* fix tests to work with lux-datasets

* fix init

* remove lxml dependency

* remove html test

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Improved warning message stack trace for unexpected error (#145)

* Moved table_name parameter to frame.py. Removed executor_type parameter

executor_type parameter no longer necessary to maintain

* Fixed reference to table_name parameter

table_name is now a parameter within frame.py

* bug fix patching #146 (#159)
* remove sys.tracebacklimit to avoid `ERROR:root:Internal Python error in the inspect module`
* changed SyntaxError to TypeError to reserved SyntaxError for Pandas native syntax problems

* Ensure that recommendation and current_vis properties are accessible before df first printed (#159)

* bugfix erased `name` dtype in LuxSeries (#140)

* Adjusted Functions to Set SQL Connection

Moved set_SQL_connection function to config. Added set_SQL_table function within frame.py to let users specify which database table will be associated with their dataframe

* Update Makefile and pyproject.toml (#160)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version

* remove dev dependencies

* first pass -- inline comments

* _config/config.py

* delete test notebook

* action

* line length 105

* executor

* interestingness

* processor

* vislib

* tests, travis, CONTRIBUTING

* .format
() changed

* replace tabs with escape chars

* update using black

* more rewrites and merges into single line

* update pyproject.toml and makefile

* updating contributing doc

* Update CONTRIBUTING.md

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Update README.md

* Update SQLExecutor name parameter

* Merging master branch with sql engine. Moving executor parameters to config

* Parameter Bug Fix

Lux DataFrame current_vis should be an empty list after recs are expired.

Executor name for small_df and very_small_df checks should be "PandasExecutor"

* Reference Fix in Warning

Executor check here should look for name "PandasExecutor"

* Black Formatting

* Black formatting

* Cleaned up executor imports, Fixed issue in AltairRenderer

Issue where Altair Renderer was not using lux.config.executor

* Black formatting

Co-authored-by: 19thyneb <thyne.boonmark@gmail.com>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>
Co-authored-by: cjachekang <47467363+cjachekang@users.noreply.github.com>
Co-authored-by: Caitlyn Chen <caitlynachen@gmail.com>
Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
Co-authored-by: Kunal Agarwal <32151899+westernguy2@users.noreply.github.com>
Co-authored-by: jinimukh <46768380+jinimukh@users.noreply.github.com>
Co-authored-by: Kunal Agarwal <kagarwal2@berkeley.edu>
Co-authored-by: Jared Zhao <jaredzhao@berkeley.edu>
Co-authored-by: Piyush Gupta <piyushg9794@gmail.com>

* Fixed Index Issue in Pandas Executor

Issue caused when user sets an index. The Pandas Executor was not correctly renaming this new index column to Record in execute_aggregate()

* Added tests for set_index functions

* Black formatting

* Update Pandas Executor to handle NA values

Readded missing dropna parameter within execute_aggregate() groupby function call

* Update to Config, and Compiler/Interestingness Tests

Removed duplicate set_SQL_connection function from config. Updated tests to reflect these changes.

Merged in recent changes in master branch.

* Black formatting

* Update Requirements.txt

Updated to include numpy version requirement

* Update to Sql-Engine (#190)

* Merging Recent SQL Executor changes

* Fix to Validator

Uses unique value metadata to verify if a value is valid

* Fix Bug with Widget Rendering

frame.py was trying to import luxWidget instead of luxwidget

* Added Number of Observations to MetaData, Fixed Interestingness issue with SQL Executor

Some interestingness functions required the number of observations in the data and visualization, so I added these values to the metadata to make the scoring work when using the SQL executor

Added tests for SQL executor

* Re-added Licensing Headers

* Adding Recent frame.py changes

* Adjusted SQL Executor Tests

Removed lines that changed Year column type to datetime

* Update Frame with new Action Registering

* Resolving Conflicts in frame.py

* Commenting out local SQL Executor tests

SQL Executor tests interfering with travis build, commenting out for now

* Update correlation.py

* Update frame.py

* bugfix: "number of remaining bars" text overcounts for colored bar charts
* update number of bars calculation to account for when len(data) double counts

* Fixing Code Format

* Cleaning up Pandas Executor imports

* Fix Validation Bug

Issue where validator was relying on metadata which was not yet generated, moved metadata calculation before validation step in frame.py

* Changed metadata variable name

Renamed num_obs to length, removed ordinal variable from Executor mapping function

* Adding support for setting intent on front end (#112)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* Make default_display a global setting (#121)

* remove and register action functions

* update changes inframe.py

* update changes inframe.py

* add documentation and changes

* indentation and comments

* new line

* globally defined default display works with warning

* no examples

* add back space

* new line

* uncomment docstring

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>

* Added script to generate Postgresql database

Updated travis.yml file to create postgresql database in test instance.

Added script to populate test database with data.

* Update upload_car_data.py

Updated database credentials

* Updated script name in travis.yml

* Removed unnecessary import from travis.yml

* Added psycopg2 to requirements.txt

* Creating Postgres test database in travis

* Fixed directory issue

* Updated SQL Executor Tests

Added tests for basic SQL Executor functionality.

* Update requirements.txt (#128)

* basic scatterplot experiments

* experiment results with manually binned heatmaps

* experiment result

* incorporated heatmap code into executor and renderer

* additional experiments to evaluate scatter v.s. heatmap performance

* experiment based on real estate and airbnb data

* modified general sampling criteria, suppress SettingWithCopyWarning stemming from groupby .agg (#93)

* decrease sampling parameter

* change sampling strategy (above threshold keep 3/4 of data)

* remove experiment dir

* modified performance param

* enforce lux-widget minimum version

* update requirement.txt

* separate dev and install requirements

* replaced _exportedVisIdxs --> _selectedVisIdxs

* bugfix: plot config error when current_vis is None

* Added sql_executor example notebook, minor bug fix

Added an example notebook to showcase how to use the sql-engine.

Fixed variable reference in interestingness.py that was causing issues.

* Add LuxSeries Implementation (#122)

* add preliminary groupby fixes

* preliminary LuxSeries implementation

* add tests for new Series implementation

* clean up the added code

* minor code changes

* fix issues with Vis with index

* small fixes

* remove comments

* bugfix column group display empty Vis involving groupby index

* bugfix Cylinders not showing up as bar charts

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* add black to travis (#127)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version

* remove dev dependencies

* fix doc failing from black format

* Cleaned SQL Executor Example Notebook

restarted kernel and cleared output

* Update custom action reference to executor

Now uses executor tied to the dataframe for execution

* Updated Interestingness Tests (#133)

* add black

* update cars dataset and tests

* Delete old dataset

* Updated Interestingness Tests

Updated tests to use the newly updated cars dataset

* switch to local cars reference

Co-authored-by: Kunal Agarwal <kagarwal2@berkeley.edu>
Co-authored-by: Kunal Agarwal <32151899+westernguy2@users.noreply.github.com>
Co-authored-by: 19thyneb <thyne.boonmark@gmail.com>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* fix broken link in docs

* Updated Tests, Added benchmarking for SQL Executor

Updated Compiler and Interestingness tests to work for SQL executor.

Updated SQL Executor to have some benchmarking code for tracking query performance.

* Merge with upstream branch, added preliminary benchmarking code

* Better warning message for Vis and VisList (#135)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* adding warning message for Vis intents being > 1

* passes tests and intent < 3

* minor change to error message, added test

* run black

* accounted for more edge cases and hid traceback

* fixed typo

* added tests

* format w/ black

* ran black again

* Update Vis.py

minor readability changes

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Pandas rewrite Performance optimizations  (#136)

* basic scatterplot experiments

* experiment results with manually binned heatmaps

* experiment result

* incorporated heatmap code into executor and renderer

* additional experiments to evaluate scatter v.s. heatmap performance

* experiment based on real estate and airbnb data

* modified general sampling criteria, suppress SettingWithCopyWarning stemming from groupby .agg (#93)

* decrease sampling parameter

* change sampling strategy (above threshold keep 3/4 of data)

* remove experiment dir

* modified performance param

* enforce lux-widget minimum version

* update requirement.txt

* testing out modin (Recursion error)

* create modin executor, all else in sync with master changes

* rewrote .loc with column reference, speed up by 100x

* replace agg("count") with .count() --> ~0.1ms speedup

* run black

* Added 2D Binning functionality to SQL Executor

added 2D binning to replace scatterplots when using SQL executor.

* Update README.md

update slack link

* Updated temporal detection and tests (#139)

* Updated temporal detection and tests

* Reformatted code with black

* Update PandasExecutor.py

* added stock date test

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Fix Inline comments breaking to new lines (#137)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version

* remove dev dependencies

* first pass -- inline comments

* _config/config.py

* delete test notebook

* action

* line length 105

* executor

* interestingness

* processor

* vislib

* tests, travis, CONTRIBUTING

* .format
() changed

* replace tabs with escape chars

* update using black

* more rewrites and merges into single line

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Improve warning message when values specified as attributes (#143)

* Improve warning message when values specified as attributes (#142)

* added test, ran black

* bugfix test

* Better warning message for Vis and VisList (#146)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* adding warning message for Vis intents being > 1

* passes tests and intent < 3

* minor change to error message, added test

* run black

* accounted for more edge cases and hid traceback

* fixed typo

* added tests

* format w/ black

* ran black again

* Update Vis.py

minor readability changes

* added check and tests for Vis list and | syntax

* ran black

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Updated docs for JupyterLab (#148)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* updated install and faq

* added install_lab.sh script

* Global shared variable in test (#144) (#149)

* using global shared variable in test (lux-org#144)

* modified fixture scope as session, resolved dependency test cases

* run black

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Updated 2D Binning Functionality

Interestingness function now compatible with 2D binning with SQL Executor. Fixed issue where some datapoints in heatmap data were of string type instead of integer.

* documentation for custom actions (#134)

* documentation for custom actions

* fix config tests

* fix documentaion links

* Add default display Config Class documentation

* delete hpi

* doc resolved changes

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Patch failing test (#134)

* Patch failing test (#134)

* Patch failing test (#134)

* Added Heatmap generation to SQL Executor, Bug fix in PandasExecutor

Added 2D Binning function to collect data for heatmaps in the SQL Executor and updated compiler test to reflect heatmap changes in SQL Executor

Fixed issue within PandasExecutor where 2D binning function would not color heatmap using temporal variables

* Updated Code Formatting with Black

* Update Requirements to include psycopg2

* Update upload_car_data.py

Updated to use newest car.csv file

* Update Compiler tests to use correct test DB

* Removed Benchmarking Code

* Fixing Black Formatting

* Add Toggle button for LuxSeries (#153)

* add black

* add groupby to history

* add LuxSeries visualization implementation

* remove groupby extending

* run black

* merge master into branch

* run black

* Reformat Warnings Labels (#151)

* add format for warnings

* fix small details

* globally defined lux

* fix formatting

* Delete similarity.py

* Rename similarity_old.py to similarity.py

* fix commit

* update master with changes to warning labels

* fix formatting

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>

* Make plot_config a global variable (#152)

* plot_config made global config

* docs and tests updates; black formatting

* Delete Untitled.ipynb

* cleanup

* remove data encapsulation

* black formatting

* Update style.rst

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Patch documentation (#134)

* code cleanup
* making LuxDataFrame pickle-able
* various simplification and rewrite to Compiler and Vis
* changing `render_VSpec` to `to_code`
* bugfix in filter (list comprehension lazily evaluated)

* Moved Executor Parameters to Global Config

* Black formatting

* Fix issue with read_json and add tests for different file types (#156)

* fix read_json bug and add tests

* convert tests to reference lux-datasets

* run black

* remove comments

* Update __init__.py

* Update test_pandas_coverage.py

new_df --> df

* fix tests to work with lux-datasets

* fix init

* remove lxml dependency

* remove html test

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Improved warning message stack trace for unexpected error (#145)

* Moved table_name parameter to frame.py. Removed executor_type parameter

executor_type parameter no longer necessary to maintain

* Fixed reference to table_name parameter

table_name is now a parameter within frame.py

* bug fix patching #146 (#159)
* remove sys.tracebacklimit to avoid `ERROR:root:Internal Python error in the inspect module`
* changed SyntaxError to TypeError to reserved SyntaxError for Pandas native syntax problems

* Ensure that recommendation and current_vis properties are accessible before df first printed (#159)

* bugfix erased `name` dtype in LuxSeries (#140)

* Adjusted Functions to Set SQL Connection

Moved set_SQL_connection function to config. Added set_SQL_table function within frame.py to let users specify which database table will be associated with their dataframe

* Update Makefile and pyproject.toml (#160)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version

* remove dev dependencies

* first pass -- inline comments

* _config/config.py

* delete test notebook

* action

* line length 105

* executor

* interestingness

* processor

* vislib

* tests, travis, CONTRIBUTING

* .format
() changed

* replace tabs with escape chars

* update using black

* more rewrites and merges into single line

* update pyproject.toml and makefile

* updating contributing doc

* Update CONTRIBUTING.md

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Update README.md

* Update SQLExecutor name parameter

* Merging master branch with sql engine. Moving executor parameters to config

* Parameter Bug Fix

Lux DataFrame current_vis should be an empty list after recs are expired.

Executor name for small_df and very_small_df checks should be "PandasExecutor"

* Reference Fix in Warning

Executor check here should look for name "PandasExecutor"

* Black Formatting

* Black formatting

* bump version number and requirements

* PATCH v0.2.1.1
* remove __future__ annotations dependency
* remove channel inheritance in Enhance
* bugfix 3-clause Vis example in 5-datetime.ipynb
* update README

* Fix Executor Reference

Update current_vis() to reference lux.config.executor

* Update frame.py

* Moved set functions to global config

* Cleaned up executor imports, Fixed issue in AltairRenderer

Issue where Altair Renderer was not using lux.config.executor

* Black formatting

* Moved Executor Parameters to Global Config (#157)

* Moved Executor Parameters to Global Config

* Black formatting

* Moved table_name parameter to frame.py. Removed executor_type parameter

executor_type parameter no longer necessary to maintain

* Fixed reference to table_name parameter

table_name is now a parameter within frame.py

* Adjusted Functions to Set SQL Connection

Moved set_SQL_connection function to config. Added set_SQL_table function within frame.py to let users specify which database table will be associated with their dataframe

* Update SQLExecutor name parameter

* Fix Executor Reference

Update current_vis() to reference lux.config.executor

* Update frame.py

* Moved set functions to global config

Co-authored-by: 19thyneb <thyne.boonmark@gmail.com>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* save_as_html feature (#170)
* note this requires unpkg depedency from latest npm release (for now download https://github.com/lux-org/lux-widget/blob/master/luxwidget/nbextension/static/index.js, rename it luxwidget.js and place it in the same directory as the exported HTML)

* Updating documentation for lux-widget v0.1.2 release (#176)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* Updated readme

* updated readthedoc documentation

* added config to default display documentation

* Update README.md

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Fix bug caused by `groupby.agg` on column with many unique values (#174)

* update export tutorial to add explanation for standalone argument

* minor fixes and remove cell output in notebooks

* added contributing doc

* fix bugs and uncomment some tests

* remove raise warning

* remove unnecessary import

* split up rename test into two parts

* fix setting warning, fix data_type bugs and add relevant tests

* remove ordinal data type

* add test for small dataframe resetting index

* add loc and iloc tests

* fix attribute access directly to dataframe

* add small changes to code

* added test for qcut and cut

* add check if dtype is Interval

* added qcut test

* fix Record KeyError

* add tests

* take care of reset_index case

* small edits

* add data_model to column_group Clause

* small edits for row_group

* fixes to row group

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Update save_as_html docs (#170)

* Update README
*remove jupyter lab url

* Update README.md

fix slack link

* Fixed Index Issue in Pandas Executor

Issue caused when user sets an index. The Pandas Executor was not correctly renaming this new index column to Record in execute_aggregate()

* Making Lux more robust with missing values and NaN (#179) (#180)

* improve datetime warning message with starter templates

* Handling NaN value errors
* skipping validator check for NaN filter values
* adding special case for PandasExecutor to map filter NaN to isna()
* fixing unevenness metric when bar values are NaN
* eliminate 1-cardinality filters in Filter action (since equal to overall)
* fixed deviation array unequal bug when NaN

* Handling NaN filter and data type
* fixed data type detection when int coerced to float when containing NaN
* added test for applying NaN filter

* Ensure that LuxSeries displayed when there is NaN
* ensure that NaNs are not dropped in groupbys
* exclude NaN values in deviation calculation
* fix unnamed series issue
* improved debugging message for LuxSeries

* Override pd.Series with LuxSeries

* Fixes for type checking and line charts with NaNs
* exclude NaN for line charts to prevent large axes offsetting
* improved type checking for float no-longer NaN columns
* fixed and improved deviation calculation test

* added float categorical test

* bump version and requirement

* Added tests for set_index functions

* Black formatting

* Update Pandas Executor to handle NA values

Readded missing dropna parameter within execute_aggregate() groupby function call

* Update to Config, and Compiler/Interestingness Tests

Removed duplicate set_SQL_connection function from config. Updated tests to reflect these changes.

Merged in recent changes in master branch.

* Black formatting

* Update Requirements.txt

Updated to include numpy version requirement

Co-authored-by: 19thyneb <thyne.boonmark@gmail.com>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>
Co-authored-by: cjachekang <47467363+cjachekang@users.noreply.github.com>
Co-authored-by: Caitlyn Chen <caitlynachen@gmail.com>
Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
Co-authored-by: Kunal Agarwal <32151899+westernguy2@users.noreply.github.com>
Co-authored-by: jinimukh <46768380+jinimukh@users.noreply.github.com>
Co-authored-by: Kunal Agarwal <kagarwal2@berkeley.edu>
Co-authored-by: Jared Zhao <jaredzhao@berkeley.edu>
Co-authored-by: Piyush Gupta <piyushg9794@gmail.com>

* Update SQL Executor Documentation

Updated documentation in SQLExecutor.py.

Updated example notebook for SQLExecutor

* Updated SQLExecutor Example Notebook

Updated example notebook for the SQL Executor and the script to upload the example dataset to a local Postgres database.

* Black Formatting

* Update to SQL Executor Example Notebook (#193)

* Merging Recent SQL Executor changes

* Fix to Validator

Uses unique value metadata to verify if a value is valid

* Fix Bug with Widget Rendering

frame.py was trying to import luxWidget instead of luxwidget

* Added Number of Observations to MetaData, Fixed Interestingness issue with SQL Executor

Some interestingness functions required the number of observations in the data and visualization, so I added these values to the metadata to make the scoring work when using the SQL executor

Added tests for SQL executor

* Re-added Licensing Headers

* Adding Recent frame.py changes

* Adjusted SQL Executor Tests

Removed lines that changed Year column type to datetime

* Update Frame with new Action Registering

* Resolving Conflicts in frame.py

* Commenting out local SQL Executor tests

SQL Executor tests interfering with travis build, commenting out for now

* Update correlation.py

* Update frame.py

* bugfix: "number of remaining bars" text overcounts for colored bar charts
* update number of bars calculation to account for when len(data) double counts

* Fixing Code Format

* Cleaning up Pandas Executor imports

* Fix Validation Bug

Issue where validator was relying on metadata which was not yet generated, moved metadata calculation before validation step in frame.py

* Changed metadata variable name

Renamed num_obs to length, removed ordinal variable from Executor mapping function

* Adding support for setting intent on front end (#112)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* Make default_display a global setting (#121)

* remove and register action functions

* update changes inframe.py

* update changes inframe.py

* add documentation and changes

* indentation and comments

* new line

* globally defined default display works with warning

* no examples

* add back space

* new line

* uncomment docstring

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>

* Added script to generate Postgresql database

Updated travis.yml file to create postgresql database in test instance.

Added script to populate test database with data.

* Update upload_car_data.py

Updated database credentials

* Updated script name in travis.yml

* Removed unnecessary import from travis.yml

* Added psycopg2 to requirements.txt

* Creating Postgres test database in travis

* Fixed directory issue

* Updated SQL Executor Tests

Added tests for basic SQL Executor functionality.

* Update requirements.txt (#128)

* basic scatterplot experiments

* experiment results with manually binned heatmaps

* experiment result

* incorporated heatmap code into executor and renderer

* additional experiments to evaluate scatter v.s. heatmap performance

* experiment based on real estate and airbnb data

* modified general sampling criteria, suppress SettingWithCopyWarning stemming from groupby .agg (#93)

* decrease sampling parameter

* change sampling strategy (above threshold keep 3/4 of data)

* remove experiment dir

* modified performance param

* enforce lux-widget minimum version

* update requirement.txt

* separate dev and install requirements

* replaced _exportedVisIdxs --> _selectedVisIdxs

* bugfix: plot config error when current_vis is None

* Added sql_executor example notebook, minor bug fix

Added an example notebook to showcase how to use the sql-engine.

Fixed variable reference in interestingness.py that was causing issues.

* Add LuxSeries Implementation (#122)

* add preliminary groupby fixes

* preliminary LuxSeries implementation

* add tests for new Series implementation

* clean up the added code

* minor code changes

* fix issues with Vis with index

* small fixes

* remove comments

* bugfix column group display empty Vis involving groupby index

* bugfix Cylinders not showing up as bar charts

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* add black to travis (#127)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version

* remove dev dependencies

* fix doc failing from black format

* Cleaned SQL Executor Example Notebook

restarted kernel and cleared output

* Update custom action reference to executor

Now uses executor tied to the dataframe for execution

* Updated Interestingness Tests (#133)

* add black

* update cars dataset and tests

* Delete old dataset

* Updated Interestingness Tests

Updated tests to use the newly updated cars dataset

* switch to local cars reference

Co-authored-by: Kunal Agarwal <kagarwal2@berkeley.edu>
Co-authored-by: Kunal Agarwal <32151899+westernguy2@users.noreply.github.com>
Co-authored-by: 19thyneb <thyne.boonmark@gmail.com>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* fix broken link in docs

* Updated Tests, Added benchmarking for SQL Executor

Updated Compiler and Interestingness tests to work for SQL executor.

Updated SQL Executor to have some benchmarking code for tracking query performance.

* Merge with upstream branch, added preliminary benchmarking code

* Better warning message for Vis and VisList (#135)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* adding warning message for Vis intents being > 1

* passes tests and intent < 3

* minor change to error message, added test

* run black

* accounted for more edge cases and hid traceback

* fixed typo

* added tests

* format w/ black

* ran black again

* Update Vis.py

minor readability changes

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Pandas rewrite Performance optimizations  (#136)

* basic scatterplot experiments

* experiment results with manually binned heatmaps

* experiment result

* incorporated heatmap code into executor and renderer

* additional experiments to evaluate scatter v.s. heatmap performance

* experiment based on real estate and airbnb data

* modified general sampling criteria, suppress SettingWithCopyWarning stemming from groupby .agg (#93)

* decrease sampling parameter

* change sampling strategy (above threshold keep 3/4 of data)

* remove experiment dir

* modified performance param

* enforce lux-widget minimum version

* update requirement.txt

* testing out modin (Recursion error)

* create modin executor, all else in sync with master changes

* rewrote .loc with column reference, speed up by 100x

* replace agg("count") with .count() --> ~0.1ms speedup

* run black

* Added 2D Binning functionality to SQL Executor

added 2D binning to replace scatterplots when using SQL executor.

* Update README.md

update slack link

* Updated temporal detection and tests (#139)

* Updated temporal detection and tests

* Reformatted code with black

* Update PandasExecutor.py

* added stock date test

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Fix Inline comments breaking to new lines (#137)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version

* remove dev dependencies

* first pass -- inline comments

* _config/config.py

* delete test notebook

* action

* line length 105

* executor

* interestingness

* processor

* vislib

* tests, travis, CONTRIBUTING

* .format
() changed

* replace tabs with escape chars

* update using black

* more rewrites and merges into single line

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Improve warning message when values specified as attributes (#143)

* Improve warning message when values specified as attributes (#142)

* added test, ran black

* bugfix test

* Better warning message for Vis and VisList (#146)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* adding warning message for Vis intents being > 1

* passes tests and intent < 3

* minor change to error message, added test

* run black

* accounted for more edge cases and hid traceback

* fixed typo

* added tests

* format w/ black

* ran black again

* Update Vis.py

minor readability changes

* added check and tests for Vis list and | syntax

* ran black

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Updated docs for JupyterLab (#148)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* updated install and faq

* added install_lab.sh script

* Global shared variable in test (#144) (#149)

* using global shared variable in test (lux-org#144)

* modified fixture scope as session, resolved dependency test cases

* run black

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Updated 2D Binning Functionality

Interestingness function now compatible with 2D binning with SQL Executor. Fixed issue where some datapoints in heatmap data were of string type instead of integer.

* documentation for custom actions (#134)

* documentation for custom actions

* fix config tests

* fix documentaion links

* Add default display Config Class documentation

* delete hpi

* doc resolved changes

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Patch failing test (#134)

* Patch failing test (#134)

* Patch failing test (#134)

* Added Heatmap generation to SQL Executor, Bug fix in PandasExecutor

Added 2D Binning function to collect data for heatmaps in the SQL Executor and updated compiler test to reflect heatmap changes in SQL Executor

Fixed issue within PandasExecutor where 2D binning function would not color heatmap using temporal variables

* Updated Code Formatting with Black

* Update Requirements to include psycopg2

* Update upload_car_data.py

Updated to use newest car.csv file

* Update Compiler tests to use correct test DB

* Removed Benchmarking Code

* Fixing Black Formatting

* Add Toggle button for LuxSeries (#153)

* add black

* add groupby to history

* add LuxSeries visualization implementation

* remove groupby extending

* run black

* merge master into branch

* run black

* Reformat Warnings Labels (#151)

* add format for warnings

* fix small details

* globally defined lux

* fix formatting

* Delete similarity.py

* Rename similarity_old.py to similarity.py

* fix commit

* update master with changes to warning labels

* fix formatting

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>

* Make plot_config a global variable (#152)

* plot_config made global config

* docs and tests updates; black formatting

* Delete Untitled.ipynb

* cleanup

* remove data encapsulation

* black formatting

* Update style.rst

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Patch documentation (#134)

* code cleanup
* making LuxDataFrame pickle-able
* various simplification and rewrite to Compiler and Vis
* changing `render_VSpec` to `to_code`
* bugfix in filter (list comprehension lazily evaluated)

* Moved Executor Parameters to Global Config

* Black formatting

* Fix issue with read_json and add tests for different file types (#156)

* fix read_json bug and add tests

* convert tests to reference lux-datasets

* run black

* remove comments

* Update __init__.py

* Update test_pandas_coverage.py

new_df --> df

* fix tests to work with lux-datasets

* fix init

* remove lxml dependency

* remove html test

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Improved warning message stack trace for unexpected error (#145)

* Moved table_name parameter to frame.py. Removed executor_type parameter

executor_type parameter no longer necessary to maintain

* Fixed reference to table_name parameter

table_name is now a parameter within frame.py

* bug fix patching #146 (#159)
* remove sys.tracebacklimit to avoid `ERROR:root:Internal Python error in the inspect module`
* changed SyntaxError to TypeError to reserved SyntaxError for Pandas native syntax problems

* Ensure that recommendation and current_vis properties are accessible before df first printed (#159)

* bugfix erased `name` dtype in LuxSeries (#140)

* Adjusted Functions to Set SQL Connection

Moved set_SQL_connection function to config. Added set_SQL_table function within frame.py to let users specify which database table will be associated with their dataframe

* Update Makefile and pyproject.toml (#160)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version

* remove dev dependencies

* first pass -- inline comments

* _config/config.py

* delete test notebook

* action

* line length 105

* executor

* interestingness

* processor

* vislib

* tests, travis, CONTRIBUTING

* .format
() changed

* replace tabs with escape chars

* update using black

* more rewrites and merges into single line

* update pyproject.toml and makefile

* updating contributing doc

* Update CONTRIBUTING.md

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Update README.md

* Update SQLExecutor name parameter

* Merging master branch with sql engine. Moving executor parameters to config

* Parameter Bug Fix

Lux DataFrame current_vis should be an empty list after recs are expired.

Executor name for small_df and very_small_df checks should be "PandasExecutor"

* Reference Fix in Warning

Executor check here should look for name "PandasExecutor"

* Black Formatting

* Black formatting

* bump version number and requirements

* PATCH v0.2.1.1
* remove __future__ annotations dependency
* remove channel inheritance in Enhance
* bugfix 3-clause Vis example in 5-datetime.ipynb
* update README

* Fix Executor Reference

Update current_vis() to reference lux.config.executor

* Update frame.py

* Moved set functions to global config

* Cleaned up executor imports, Fixed issue in AltairRenderer

Issue where Altair Renderer was not using lux.config.executor

* Black formatting

* Moved Executor Parameters to Global Config (#157)

* Moved Executor Parameters to Global Config

* Black formatting

* Moved table_name parameter to frame.py. Removed executor_type parameter

executor_type parameter no longer necessary to maintain

* Fixed reference to table_name parameter

table_name is now a parameter within frame.py

* Adjusted Functions to Set SQL Connection

Moved set_SQL_connection function to config. Added set_SQL_table function within frame.py to let users specify which database table will be associated with their dataframe

* Update SQLExecutor name parameter

* Fix Executor Reference

Update current_vis() to reference lux.config.executor

* Update frame.py

* Moved set functions to global config

Co-authored-by: 19thyneb <thyne.boonmark@gmail.com>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* save_as_html feature (#170)
* note this requires unpkg depedency from latest npm release (for now download https://github.com/lux-org/lux-widget/blob/master/luxwidget/nbextension/static/index.js, rename it luxwidget.js and place it in the same directory as the exported HTML)

* Updating documentation for lux-widget v0.1.2 release (#176)

* added functionality to delete Vis

* fixed deletion logic

* add observer to automatically update deletions

* able to refresh widget on setting intent

* support for setting intent from frontend

* quick fix to output

* changed variable intentindex name

* added better error msg for > 1 intent for vis

* reverting some changes

* Updated readme

* updated readthedoc documentation

* added config to default display documentation

* Update README.md

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Fix bug caused by `groupby.agg` on column with many unique values (#174)

* update export tutorial to add explanation for standalone argument

* minor fixes and remove cell output in notebooks

* added contributing doc

* fix bugs and uncomment some tests

* remove raise warning

* remove unnecessary import

* split up rename test into two parts

* fix setting warning, fix data_type bugs and add relevant tests

* remove ordinal data type

* add test for small dataframe resetting index

* add loc and iloc tests

* fix attribute access directly to dataframe

* add small changes to code

* added test for qcut and cut

* add check if dtype is Interval

* added qcut test

* fix Record KeyError

* add tests

* take care of reset_index case

* small edits

* add data_model to column_group Clause

* small edits for row_group

* fixes to row group

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Update save_as_html docs (#170)

* Update README
*remove jupyter lab url

* Update README.md

fix slack link

* Fixed Index Issue in Pandas Executor

Issue caused when user sets an index. The Pandas Executor was not correctly renaming this new index column to Record in execute_aggregate()

* Making Lux more robust with missing values and NaN (#179) (#180)

* improve datetime warning message with starter templates

* Handling NaN value errors
* skipping validator check for NaN filter values
* adding special case for PandasExecutor to map filter NaN to isna()
* fixing unevenness metric when bar values are NaN
* eliminate 1-cardinality filters in Filter action (since equal to overall)
* fixed deviation array unequal bug when NaN

* Handling NaN filter and data type
* fixed data type detection when int coerced to float when containing NaN
* added test for applying NaN filter

* Ensure that LuxSeries displayed when there is NaN
* ensure that NaNs are not dropped in groupbys
* exclude NaN values in deviation calculation
* fix unnamed series issue
* improved debugging message for LuxSeries

* Override pd.Series with LuxSeries

* Fixes for type checking and line charts with NaNs
* exclude NaN for line charts to prevent large axes offsetting
* improved type checking for float no-longer NaN columns
* fixed and improved deviation calculation test

* added float categorical test

* bump version and requirement

* Added tests for set_index functions

* Black formatting

* Update Pandas Executor to handle NA values

Readded missing dropna parameter within execute_aggregate() groupby function call

* Update to Config, and Compiler/Interestingness Tests

Removed duplicate set_SQL_connection function from config. Updated tests to reflect these changes.

Merged in recent changes in master branch.

* Black formatting

* Update Requirements.txt

Updated to include numpy version requirement

* Update SQL Executor Documentation

Updated documentation in SQLExecutor.py.

Updated example notebook for SQLExecutor

* Updated SQLExecutor Example Notebook

Updated example notebook for the SQL Executor and the script to upload the example dataset to a local Postgres database.

* Black Formatting

Co-authored-by: 19thyneb <thyne.boonmark@gmail.com>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>
Co-authored-by: cjachekang <47467363+cjachekang@users.noreply.github.com>
Co-authored-by: Caitlyn Chen <caitlynachen@gmail.com>
Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
Co-authored-by: Kunal Agarwal <32151899+westernguy2@users.noreply.github.com>
Co-authored-by: jinimukh <46768380+jinimukh@users.noreply.github.com>
Co-authored-by: Kunal Agarwal <kagarwal2@berkeley.edu>
Co-authored-by: Jared Zhao <jaredzhao@berkeley.edu>
Co-authored-by: Piyush Gupta <piyushg9794@gmail.com>

* Update to SQL Executor Tests

Adjusted tests to reference correct PostgreSQL table

* Update Travis file and SQL Executor Tests

Updated the travis.yml and sql executor test scripts to refer to the correct postgres database

* Update .travis.yml

* fixed merge conflict issues. vis.data shows None DF.

* Merge master into sql-engine + minor mergeconflict fixes

* Removing the PYNB

* Cleaning up obsolete code

* Merging the master branch changes into sql-engine (#208)

* Similarity as a default action (#182)

* similarity formatting fixed

* added another similarity test case; fixed bug where colored heatmap dimension is temporal (invalidate all 2 msr 1 temporal case)

* filter and similarity together

* filter and similarity together

* remove filter

* black line length

* file reorg and clean; change sim metric

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* bump numpy min version for travis

* Special character issue (#184)

* rename col

* broken

* fixed period replacement bug

* add tests

* refine tests

* refine tests

* remove cols

* fix tests

* add agg

* fixed tests

* clean up PR

Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Colored bar interestingness bug (#189)
* rewrote chi2 contingency with pd.crosstab
* catching KeyError issue with chi2 contingency
* padding interestingness with warning instead of error
* interestingness now reuses ndim and nmsr computed in Compiler
* bug fix for parser with int values
* improve Vis repr to better display inferred intent when data is absent but fully compiled intent (all clauses)

* Add sampling parameters as a global config (#192)

* update export tutorial to add explanation for standalone argument

* minor fixes and remove cell output in notebooks

* added contributing doc

* fix bugs and uncomment some tests

* remove raise warning

* remove unnecessary import

* split up rename test into two parts

* fix setting warning, fix data_type bugs and add relevant tests

* remove ordinal data type

* add test for small dataframe resetting index

* add loc and iloc tests

* fix attribute access directly to dataframe

* add small changes to code

* added test for qcut and cut

* add check if dtype is Interval

* added qcut test

* fix Record KeyError

* add tests

* take care of reset_index case

* small edits

* add data_model to column_group Clause

* small edits for row_group

* fixes to row group

* add config for start and cap for samples

* finish sampling config and tests

* black formatting

* add documentation for sampling config

* remove small added issues

* minor changes to docs

* implement heatmap flag and add tests

* black formatting and documentation edits

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Coalesce all data_type attributes of frame into one (#185)

* coalesce data_types into data_type_lookup

* black reformat

* changed to better variable names

* lux not defined error

* fixed

* black format

* Update CONTRIBUTING.md

* Bug Fix: User-provided Index causes KeyError in Pandas Execution (#191)

* Moved Executor Parameters to Global Config

* Black formatting

* Moved table_name parameter to frame.py. Removed executor_type parameter

executor_type parameter no longer necessary to maintain

* Fixed reference to table_name parameter

table_name is now a parameter within frame.py

* Adjusted Functions to Set SQL Connection

Moved set_SQL_connection function to config. Added set_SQL_table function within frame.py to let users specify which database table will be associated with their dataframe

* Update SQLExecutor name parameter

* Fix Executor Reference

Update current_vis() to reference lux.config.executor

* Update frame.py

* Moved set functions to global config

* Fixed Index Issue in Pandas Executor

Issue caused when user sets an index. The Pandas Executor was not correctly renaming this new index column to Record in execute_aggregate()

* Added tests for set_index functions

* Black formatting

* Update Pandas Executor to handle NA values

Readded missing dropna parameter within execute_aggregate() groupby function call

* Updated Pandas Coverage Tests

Commented out set_index case which has not been addressed yet

* Black Formatting

* Update to Pandas Executor Index Handling

Cleaned up how execute_aggregrate renames index columns. Now retrieves the index name from vis.data instead of filtering out non-index columns.

Created separate test function for when user specifies an index in read_csv.

Co-authored-by: 19thyneb <thyne.boonmark@gmail.com>
Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>

* Initialize Config once only during __init__ (#194)

* basic matplotlib chart example

* migrate register default action to init

* config class

* move actions

* fixed tests

* changes

* alright

* fix plot_config

* black reformat

* black reformat

Co-authored-by: Doris Lee <dorisjunglinlee@gmail.com>
Co-authored-by: Caitlyn Chen <caitlynachen@berkeley.edu>
Co-authored-by: Ujjaini Mukhopadhyay <ujjaini@berkeley.edu>

* Update README.md

* Series Bugfix for describe and convert_dtypes (#197)

* bugfix for describe and convert_dtypes

* added back metadata series test

* black

* default to pandas display when df.dtypes printed

* Update Lux Docs (#195)

* add black to travis

* reformat all code and adjust test

* remove .idea

* fix contributing doc

* small change in contributing

* update

* reformat, update command to fix version…
  • Loading branch information
16 people authored Sep 10, 2021
1 parent 4d46ad9 commit 71136ed
Show file tree
Hide file tree
Showing 31 changed files with 1,989 additions and 357 deletions.
1 change: 1 addition & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
run: |
python lux/data/upload_car_data.py
python lux/data/upload_aug_test_data.py
python lux/data/upload_airbnb_nyc_data.py
- name: Lint check with black
run: |
black --target-version py37 --line-length 105 --check .
Expand Down
138 changes: 138 additions & 0 deletions examples/GeneralDatabase_Executor_Example.py.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{
"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
}
733 changes: 733 additions & 0 deletions examples/Lux_Code_Tracing.ipynb

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions examples/mysql_query_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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}'
19 changes: 19 additions & 0 deletions examples/postgres_query_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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}'
23 changes: 23 additions & 0 deletions examples/query_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
##############################################################################
#########################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}'
2 changes: 2 additions & 0 deletions lux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from lux.vis.Clause import Clause
from lux.core.frame import LuxDataFrame
from lux.core.sqltable import LuxSQLTable
from lux.core.joinedsqltable import JoinedSQLTable
from lux.utils.tracing_utils import LuxTracer
from ._version import __version__, version_info
from lux._config import config
from lux._config.config import warning_format
Expand Down
25 changes: 25 additions & 0 deletions lux/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
from typing import Any, Callable, Dict, Iterable, List, Optional, Union
import lux
import warnings
from lux.utils.tracing_utils import LuxTracer
import os
from lux._config.template import postgres_template, mysql_template

RegisteredOption = namedtuple("RegisteredOption", "name action display_condition args")

Expand Down Expand Up @@ -34,13 +37,18 @@ def __init__(self):
self._pandas_fallback = True
self._interestingness_fallback = True
self.heatmap_bin_size = 40
self.tracer_relevant_lines = []
self.tracer = LuxTracer()
self.query_templates = {}
self.handle_quotes = True
#####################################
#### Optimization Configurations ####
#####################################
self._sampling_start = 100000
self._sampling_cap = 1000000
self._sampling_flag = True
self._heatmap_flag = True
self._heatmap_start = 5000
self.lazy_maintain = True
self.early_pruning = True
self.early_pruning_sample_cap = 30000
Expand Down Expand Up @@ -419,11 +427,28 @@ def set_SQL_connection(self, connection):
self.set_executor_type("SQL")
self.SQLconnection = connection

def read_query_template(self, query_template):
from lux.executor.SQLExecutor import SQLExecutor

query_dict = {}
if type(query_template) is str:
for line in query_template.split("\n"):
(key, val) = line.split(":")
query_dict[key] = val.strip()
else:
with open(query_file) as f:
for line in f:
(key, val) = line.split(":")
query_dict[key] = val.strip()
self.query_templates = query_dict
self.executor = SQLExecutor()

def set_executor_type(self, exe):
if exe == "SQL":
from lux.executor.SQLExecutor import SQLExecutor

self.executor = SQLExecutor()
self.read_query_template(postgres_template)
elif exe == "Pandas":
from lux.executor.PandasExecutor import PandasExecutor

Expand Down
19 changes: 19 additions & 0 deletions lux/_config/mysql_query_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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}'
19 changes: 19 additions & 0 deletions lux/_config/postgres_query_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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}'
Loading

0 comments on commit 71136ed

Please sign in to comment.