TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

An SQL Solution for Jupyter

139 pointsby 3l3ktr4over 4 years ago

11 comments

ktpsnsover 4 years ago
This is amazing. Jupyter is already a great tool for data science and being able to directly interact with SQL (without a host&#x2F;intermediate language) is great, because it is very clean and SQL is a powerful language on its own – no need for some host language. Furthermore, vega (<a href="https:&#x2F;&#x2F;vega.github.io&#x2F;vega-lite&#x2F;" rel="nofollow">https:&#x2F;&#x2F;vega.github.io&#x2F;vega-lite&#x2F;</a>) is an amazing kind-of-declarative visualization language which mixes great with the declarative language SQL.
评论 #26087276 未加载
andreareinaover 4 years ago
The only example of how to use it is an animation that is just impossible to read :(<p>Here are the examples in the live demo[1]:<p><pre><code> %LOAD sqlite3 db=chinook.db timeout=2 shared_cache=true %XVEGA_PLOT X_FIELD EmployeeId Y_FIELD ReportsTo BIN TRUE MARK square WIDTH 100 HEIGHT 200 &lt;&gt; SELECT EmployeeId, ReportsTo FROM employees %XVEGA_PLOT X_FIELD EmployeeId Y_FIELD ReportsTo BIN MAXBINS 3 MARK bar COLOR red WIDTH 200 HEIGHT 200 &lt;&gt; SELECT EmployeeId, ReportsTo FROM employees %XVEGA_PLOT X_FIELD EmployeeId Y_FIELD ReportsTo TYPE ordinal MARK bar COLOR green WIDTH 200 HEIGHT 200 &lt;&gt; SELECT EmployeeId, ReportsTo FROM employees %XVEGA_PLOT X_FIELD Name TYPE nominal Y_FIELD ArtistId BIN MAXBINS 1 MARK line COLOR purple WIDTH 200 HEIGHT 200 &lt;&gt; SELECT Name, ArtistId FROM artists LIMIT 10 %XVEGA_PLOT X_FIELD EmployeeId GRID false Y_FIELD ReportsTo MARK area COLOR pink WIDTH 200 HEIGHT 200 &lt;&gt; SELECT EmployeeId, ReportsTo FROM employees </code></pre> [1] <a href="https:&#x2F;&#x2F;hub.gke2.mybinder.org&#x2F;user&#x2F;jupyter-xeus-xeus-sql-x6434d86&#x2F;lab" rel="nofollow">https:&#x2F;&#x2F;hub.gke2.mybinder.org&#x2F;user&#x2F;jupyter-xeus-xeus-sql-x64...</a>
评论 #26087256 未加载
plumsempyover 4 years ago
I know you pronounce it ES-KYU-EL because you used &quot;an&quot;
评论 #26085997 未加载
评论 #26084812 未加载
fulafelover 4 years ago
The Github support for notebooks is so nice (was linked from the example pic caption: <a href="https:&#x2F;&#x2F;github.com&#x2F;wangfenjin&#x2F;xeus-tidb&#x2F;blob&#x2F;develop&#x2F;examples&#x2F;TiDB.ipynb" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wangfenjin&#x2F;xeus-tidb&#x2F;blob&#x2F;develop&#x2F;example...</a>)
stevesimmonsover 4 years ago
Jupyter would be even better if it supported the seamless combination of Python and SQL code cells.<p>My notebook code typically involves a data prep stage with querying a SQL database, then downloading into Python for more complex analysis, ML modelling, integration with external data sources, etc. So the notebook has a Python kernel with SQL usually as embedded &quot;&quot;&quot;-quoted strings.<p>Does anyone have a solution to treating selected code cells as SQL - with SQL highlighting and tooltips - exposed as string variables to the Python code?<p>Sparkmagic [1] does part of this for Python&#x2F;SQL&#x2F;Spark interoperability, but as far as I recall, doesn&#x27;t support SQL syntax highlighting.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;jupyter-incubator&#x2F;sparkmagic" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jupyter-incubator&#x2F;sparkmagic</a>
评论 #26088128 未加载
评论 #26088724 未加载
评论 #26150004 未加载
评论 #26088276 未加载
aargh_aarghover 4 years ago
I followed the instructions and the sql cells work, but the xvega ones return empty output and I&#x27;m not sure how to debug that.<p><pre><code> conda create -n xeus-sql conda activate xeus-sql conda install xeus-sql soci-mysql soci-postgresql soci-sqlite jupyterlab -c conda-forge </code></pre> In conda list I see, among others:<p><pre><code> xeus 1.0.0 h78d96c3_0 conda-forge xeus-sql 0.0.8 h118ccdd_1 conda-forge xvega 0.0.10 h4bd325d_0 conda-forge xvega-bindings 0.0.10 h4bd325d_0 conda-forge </code></pre> Btw there&#x27;s a typo in the instructions: soci-postresql -&gt; soci-postgresql
评论 #26089289 未加载
geebeeover 4 years ago
This looks very promising! I will look into it.<p>When I want a tabular view, I currently either used the pandas read_sql_query method or the PandaSQL module. That does work, and I often do want to use pandas and sql together (often back and forth, depending on the operation).<p>That said, I can see a use for this tool in my work - I&#x27;m often really just interested in interacting with a database in a more visually friendly way than the command line, and it would be great to stay with Jupyter rather than having to go through a completely different UI.<p>So, yeah, nice looking tool, and thanks for posting!
seddonm1over 4 years ago
We have used <a href="https:&#x2F;&#x2F;almond.sh&#x2F;" rel="nofollow">https:&#x2F;&#x2F;almond.sh&#x2F;</a> to create a Spark SQL interpreter using Jupyter Notebooks - plus a whole lot more which you can see here: <a href="https:&#x2F;&#x2F;arc.tripl.ai&#x2F;tutorial" rel="nofollow">https:&#x2F;&#x2F;arc.tripl.ai&#x2F;tutorial</a><p>After seeing many companies writing ETL using code we decided it was too hard to manage at scale so provided this abstraction layer - which is heavily centered around expressing business logic in SQL - to standardise development (JupyterLab) and allow rapid deployments.
realitysballsover 4 years ago
Does anyone know if can work with 32-bit ODBC drivers? My industry is behind the times and the only way to interact with our ERP is 32-bit ODBC
评论 #26087444 未加载
jasmcoleover 4 years ago
Those interested in SQL notebooks can also check out <a href="https:&#x2F;&#x2F;count.co" rel="nofollow">https:&#x2F;&#x2F;count.co</a>
Vasloover 4 years ago
<i>Names almost every major sql engine except SQL Server</i><p><i>Says will work with any DB with an ODBC connection</i><p>Hmmmm
评论 #26087904 未加载