Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test environment for Postgresql Executor #124

Merged
merged 26 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
308d99c
Merging Recent SQL Executor changes
19thyneb Oct 15, 2020
daa9a0d
Fix to Validator
19thyneb Oct 16, 2020
804b0dc
Fix Bug with Widget Rendering
19thyneb Oct 17, 2020
676f3e0
Added Number of Observations to MetaData, Fixed Interestingness issue…
19thyneb Oct 19, 2020
8763df9
Re-added Licensing Headers
19thyneb Oct 19, 2020
c2b0b46
Adding Recent frame.py changes
19thyneb Oct 19, 2020
1b08461
Adjusted SQL Executor Tests
19thyneb Oct 19, 2020
38c5e7e
Update Frame with new Action Registering
19thyneb Oct 22, 2020
14d2f90
Resolving Conflicts in frame.py
19thyneb Oct 22, 2020
78d8e10
Merge branch 'sql-engine' into Database-Executor
thyneb19 Oct 22, 2020
d783b4c
Commenting out local SQL Executor tests
19thyneb Oct 22, 2020
c03e001
Merge branch 'Database-Executor' of https://github.com/thyneb19/lux i…
19thyneb Oct 22, 2020
8f0e643
Update correlation.py
dorisjlee Oct 22, 2020
d365d52
Update frame.py
dorisjlee Oct 22, 2020
7da2992
Fixing Code Format
19thyneb Oct 22, 2020
f1b7c8b
Cleaning up Pandas Executor imports
19thyneb Oct 22, 2020
d97f0e4
Fix Validation Bug
19thyneb Oct 22, 2020
582b370
Changed metadata variable name
19thyneb Oct 23, 2020
554c71f
Merge remote-tracking branch 'upstream/sql-engine' into Database-Exec…
19thyneb Oct 23, 2020
d65687a
Added script to generate Postgresql database
19thyneb Oct 25, 2020
7243b2f
Update upload_car_data.py
19thyneb Oct 25, 2020
2add76f
Updated script name in travis.yml
19thyneb Oct 25, 2020
cf74beb
Removed unnecessary import from travis.yml
19thyneb Oct 25, 2020
14d52b8
Added psycopg2 to requirements.txt
19thyneb Oct 25, 2020
379517d
Creating Postgres test database in travis
19thyneb Oct 25, 2020
a72f236
Fixed directory issue
19thyneb Oct 25, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
language: python
python:
- "3.7"
services:
- postgresql
install:
- pip install codecov
- pip install -r requirements.txt
- pip install git+https://github.com/lux-org/lux-widget
#- npm i lux-widget
before_script:
- psql -c "ALTER USER postgres WITH PASSWORD 'lux';" -U postgres
- psql -c "ALTER USER postgres WITH SUPERUSER;" -U postgres
- psql -c "ALTER DATABASE postgres OWNER TO travis;"
- psql -c "DROP schema public cascade;" -U postgres
- psql -c "CREATE schema public;" -U postgres
- psql -c "CREATE DATABASE postgres_db;" -U postgres
# command to run tests
script:
- python lux/data/upload_car_data.py
- python -m pytest tests/*.py
- pytest --cov-report term --cov=lux tests/
after_success:
Expand Down
37 changes: 37 additions & 0 deletions lux/data/upload_car_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import pandas as pd
import psycopg2
import csv

import psycopg2
conn = psycopg2.connect("host=localhost dbname=postgres_db user=postgres password=lux")
cur = conn.cursor()
cur.execute("""
DROP TABLE IF EXISTS car
""")
#create car table in postgres database
cur.execute("""
CREATE TABLE car(
name text,
milespergal numeric,
cylinders integer,
displacement numeric,
horsepower integer,
weight integer,
acceleration numeric,
year integer,
origin text
)
""")

#open car.csv and read data into database
with open('lux/data/car.csv', 'r') as f:
reader = csv.reader(f)
next(reader) # Skip the header row.
i = 0
for row in reader:
cur.execute(
"INSERT INTO car VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
row
)

conn.commit()
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Sphinx>=3.0.2
sphinx-rtd-theme>=0.4.3
lux-widget==0.1.0
# Install only to use SQLExecutor
# psycopg2>=2.8.5
# psycopg2-binary>=2.8.5
psycopg2>=2.8.5
psycopg2-binary>=2.8.5