sql-machine-learning/pysqlflow

Work rest in pysqlflow

tonyyang-svail opened this issue · 1 comments

In order to reuse ipython-sql, we need to

  • Wrap grpc client and protobuf inside a PySQLFlow client #9
  • Wrap PySQLFlow client inside a DBAPI, please be aware of pagenation.
  • Wrap DBAPI inside a sqlalchemy dialect

Then we can plug in implemented sqlalchemy dialect to ipython-sql, a user can use it as

In [1]: %load_ext sql

In [2]: %%sql sqlflow://username:password@localhost/shakes
   ...: select * from iris.iris limit 10;
Out[2]:
+--------------+-------------+--------------+-------------+-------+
| sepal_length | sepal_width | petal_length | petal_width | class |
+--------------+-------------+--------------+-------------+-------+
|          6.4 |         2.8 |          5.6 |         2.2 |     2 |
|            5 |         2.3 |          3.3 |           1 |     1 |
|          4.9 |         2.5 |          4.5 |         1.7 |     2 |
|          4.9 |         3.1 |          1.5 |         0.1 |     0 |
|          5.7 |         3.8 |          1.7 |         0.3 |     0 |
|          4.4 |         3.2 |          1.3 |         0.2 |     0 |
|          5.4 |         3.4 |          1.5 |         0.4 |     0 |
|          6.9 |         3.1 |          5.1 |         2.3 |     2 |
|          6.7 |         3.1 |          4.4 |         1.4 |     1 |
|          5.1 |         3.7 |          1.5 |         0.4 |     0 |
+--------------+-------------+--------------+-------------+-------+

These three levels of abstractions enables users to write extensions in python and perform visualizations.

ktong commented

Do we still need DBAPI if pysqlflow provides own magic command?