Bringing together the power of SQL, Python, and Javascript. Run raw, multi-threaded SQL in an IPython Notebook while concurrently executing python cells, and a ton of other features.
Find a tutorial here.
pip install sqlcell
SQLCell is a magic function for the Jupyter Notebook that executes raw, parallel, parameterized SQL queries with the ability to accept Python values as parameters and assign output data to Python variables while concurrently running Python code. And *much* more.
License: MIT License
Bringing together the power of SQL, Python, and Javascript. Run raw, multi-threaded SQL in an IPython Notebook while concurrently executing python cells, and a ton of other features.
Find a tutorial here.
pip install sqlcell
using this same technique
import sys
for i in range(1, 1100):
sys.stdout.write('\r')
sys.stdout.write("Progress: %s%% | Timer: %s | %-s" % (100*2.0, float(2)*i, '#'))
sys.stdout.flush()
display the table, if pulled from one table show button to enable editing.
For example, in my config I have four connection string LOCAL, DEV, PROD AND QA.
User should have ability to easily add connection strings.
Show dashboard/graphs for EXPLAIN ANALYZE
queries.
Maybe use dc.js/crossfilter, or a similar basic javascript graphing library.
After setting the engine, if engine argument is used on subsequent queries instead of using same connection, the current connection is closed and a new one is open which takes significant time.
SQLCell should do a check to see if the current connection string is the same as new one being passed. If so, use same connection, else open new one and persist that one until new engine passed.
If \d <table>
is executed, the body of the notification will read: d <table>
public.table database
public.table database
The SQLVARS.EXPLAIN_GRAPH doesn't get updated
convert spaghetti into lasagna.
this is used a lot, so i need to modularize
when it doesn't work, the tab-index attr doesn't get set.
SELECT * FROM table WHERE column LIKE '%''%' LIMIT 10
does not work. Searching for column that contains an apostrophe.
Add ability to add columns to tables through the UI rather than raw SQL.
Using subprocess
, we can execute psql
commands (with the -H
flag to convert output to HTML tables) from the CLI via python and get the output using subprocess.check_ouput
. Then we convert the HTML to a pandas dataframe with pd.read_html
.
import subprocess
psql_command = False
if cell.startswith('\\'):
psql_command = True
pg = ['psql', 'phTeam-allpayer', '-c', cell.strip(), '-H']
output = subprocess.check_output(pg)
data = pd.read_html(output, header=0)[0]
Testing...
Tell pandas to show leading whitespace or, if that's not a viable option, do a find/replace and replace leading whitespace with some other character, like a dash.
Check for types for quote injection into UPDATE
statement.
(ProgrammingError) column "phteam" does not exist
LINE 1: ...E branding SET host_name = 'local' WHERE brand_name = PHTEAM
^
"UPDATE branding SET host_name = 'local' WHERE brand_name = PHTEAM" {}
PHTEAM
here should be in quotes.
use this as reference.
Modify column info using \d
by making HTML table editable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.