Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hourout committed Jun 30, 2021
1 parent 8800a37 commit 4bc828f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 10 additions & 10 deletions mysql_kernel/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ipykernel.kernelbase import Kernel


__version__ = '0.3.0'
__version__ = '0.4.0'

class MysqlKernel(Kernel):
implementation = 'mysql_kernel'
Expand Down Expand Up @@ -54,25 +54,25 @@ def do_execute(self, code, silent, store_history=True, user_expressions=None, al
else:
self.engine = sa.create_engine(f'mysql+py{v}')
elif l.startswith('create database '):
pd.io.sql.execute(l, con=self.engine)
pd.io.sql.execute(v, con=self.engine)
elif l.startswith('drop database '):
pd.io.sql.execute(l, con=self.engine)
pd.io.sql.execute(v, con=self.engine)
elif l.startswith('create table '):
pd.io.sql.execute(l, con=self.engine)
pd.io.sql.execute(v, con=self.engine)
elif l.startswith('drop table '):
pd.io.sql.execute(l, con=self.engine)
pd.io.sql.execute(v, con=self.engine)
elif l.startswith('delete '):
pd.io.sql.execute(l, con=self.engine)
pd.io.sql.execute(v, con=self.engine)
elif l.startswith('alter table '):
pd.io.sql.execute(l, con=self.engine)
pd.io.sql.execute(v, con=self.engine)
elif l.startswith('insert into '):
pd.io.sql.execute(l, con=self.engine)
pd.io.sql.execute(v, con=self.engine)
else:
if self.engine:
if l.startswith('select ') and ' limit ' not in l:
output = pd.read_sql(l+' limit 1000', self.engine).to_html()
output = pd.read_sql(f'{v} limit 1000', self.engine).to_html()
else:
output = pd.read_sql(l, self.engine).to_html()
output = pd.read_sql(v, self.engine).to_html()
else:
output = 'Unable to connect to Mysql server. Check that the server is running.'
self.output(output)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def readme():
return f.read()

setup(name='mysql_kernel',
version='0.3.0',
version='0.4.0',
description='A mysql kernel for Jupyter.',
long_description=readme(),
long_description_content_type='text/markdown',
Expand All @@ -26,6 +26,7 @@ def readme():
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
Expand Down

0 comments on commit 4bc828f

Please sign in to comment.