tmthyjames / 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.
MIT License
151 stars 11 forks source link

Python3 #97

Open ndaga-drg opened 6 years ago

ndaga-drg commented 6 years ago

By the looks of it, I have a feeling that the code works with python 2.x version but would throw up errors with python 3.x. Can you please confirm if this version is compatible with python 3.x?

tmthyjames commented 6 years ago

It will throw errors for python 3, but i have tracked down those errors and can merge it in here soon.

Here are where it will throw errors:

1) python3 now uses builtins instead of __builtin__ 2) change print statement to use parens 3) change .iteritems to .items in one spot 4) change reduce to functools.reduce in one spot. 5) change unicode calls to str

I will upload the new code sometime this week, but I think this covers all incompatibility issues

maddyliu commented 6 years ago

Thank you for the beautiful tool! looking forward to the update too.

tmthyjames commented 6 years ago

@maddyliu thanks!

ndaga-drg commented 6 years ago

Cant agree more. There are a lot of features in this module which I would like to try. Will wait for your updated code. Another quick question - is this compatible with all the databases? I am trying to connect it to Snowflake.

tmthyjames commented 6 years ago

@ndaga-drg i will try to push the python2-3 compatible code this weekend.

It does not work with every database. It is optimized for Postgres, but I just got it working for SQL Server (minus some postgres-specific features like the optimization path). I've also gotten it to work with MySQL.

I would love to get it working with Snowflake. Maybe I'll work on that in the coming months.

I love this tool, but unfortunately i don't get much time to work on it. I think it has a lot of potential, especially with the new JupyterLab release.

DandiestSquare1 commented 6 years ago

+1 for Snowflake integration! Also, more than glad to help with SQL Server issues/integration, etc.