IPython-Dashboard icon indicating copy to clipboard operation
IPython-Dashboard copied to clipboard

ValueError: database flavor mysql is not supported

Open karthick87 opened this issue 7 years ago • 1 comments
trafficstars

While executing the below command with in the "IPython-Dashboard"working directory, getting an error saying mysql flavor is not supported. But from the documentation, I see that is the only supported flavor. Can you please tell me, what is the missing piece here?

For your information, I am using the following versions:

Python 2.7.10 mysql Ver 14.14 Distrib 5.6.37, for Linux (x86_64) using EditLine wrapper

[root@ror IPython-Dashboard-master]# nosetests -s dashboard.tests.testCreateData:test_create_mysql_data

###start run fun:  test_create_mysql_data ...
/root/Ipython_Dashboard/IPython-Dashboard-master/dashboard/server/utils.py:135: Warning: Unknown table 'IPD_data.businesses'
  cursor.execute(sql)
E
======================================================================
ERROR: dashboard.tests.testCreateData.test_create_mysql_data
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/root/Ipython_Dashboard/IPython-Dashboard-master/dashboard/server/utils.py", line 50, in wrapper
    result = func(*args, **kwargs)
  File "/root/Ipython_Dashboard/IPython-Dashboard-master/dashboard/tests/testCreateData.py", line 119, in test_create_mysql_data
    data.to_sql('businesses', conn.conn, if_exists='append', flavor='mysql', index=False)
  File "/usr/local/lib/python2.7/site-packages/pandas-0.22.0-py2.7-linux-x86_64.egg/pandas/core/generic.py", line 1534, in to_sql
    chunksize=chunksize, dtype=dtype)
  File "/usr/local/lib/python2.7/site-packages/pandas-0.22.0-py2.7-linux-x86_64.egg/pandas/io/sql.py", line 463, in to_sql
    pandas_sql = pandasSQL_builder(con, schema=schema, flavor=flavor)
  File "/usr/local/lib/python2.7/site-packages/pandas-0.22.0-py2.7-linux-x86_64.egg/pandas/io/sql.py", line 531, in pandasSQL_builder
    _validate_flavor_parameter(flavor)
  File "/usr/local/lib/python2.7/site-packages/pandas-0.22.0-py2.7-linux-x86_64.egg/pandas/io/sql.py", line 59, in _validate_flavor_parameter
    "supported".format(flavor=flavor))
ValueError: database flavor mysql is not supported

----------------------------------------------------------------------
Ran 1 test in 3.362s

FAILED (errors=1)

[root@ror IPython-Dashboard-master]# nosetests -s dashboard.tests.testCreateData:test_create_mysql_data

###start run fun:  test_create_mysql_data ...
/root/Ipython_Dashboard/IPython-Dashboard-master/dashboard/tests/testCreateData.py:78: Warning: Can't create database 'IPD_data'; database exists
  conn.cursor().execute('CREATE DATABASE IF NOT EXISTS {};'.format(config.sql_db))
E
======================================================================
ERROR: dashboard.tests.testCreateData.test_create_mysql_data
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/root/Ipython_Dashboard/IPython-Dashboard-master/dashboard/server/utils.py", line 50, in wrapper
    result = func(*args, **kwargs)
  File "/root/Ipython_Dashboard/IPython-Dashboard-master/dashboard/tests/testCreateData.py", line 119, in test_create_mysql_data
    data.to_sql('businesses', conn.conn, if_exists='append', flavor='mysql', index=False)
  File "/usr/local/lib/python2.7/site-packages/pandas-0.22.0-py2.7-linux-x86_64.egg/pandas/core/generic.py", line 1534, in to_sql
    chunksize=chunksize, dtype=dtype)
  File "/usr/local/lib/python2.7/site-packages/pandas-0.22.0-py2.7-linux-x86_64.egg/pandas/io/sql.py", line 463, in to_sql
    pandas_sql = pandasSQL_builder(con, schema=schema, flavor=flavor)
  File "/usr/local/lib/python2.7/site-packages/pandas-0.22.0-py2.7-linux-x86_64.egg/pandas/io/sql.py", line 531, in pandasSQL_builder
    _validate_flavor_parameter(flavor)
  File "/usr/local/lib/python2.7/site-packages/pandas-0.22.0-py2.7-linux-x86_64.egg/pandas/io/sql.py", line 59, in _validate_flavor_parameter
    "supported".format(flavor=flavor))
ValueError: database flavor mysql is not supported

----------------------------------------------------------------------
Ran 1 test in 3.537s

FAILED (errors=1)

karthick87 avatar Mar 15 '18 04:03 karthick87

do these changes in the testCreateData.py ... line 119 #data.to_sql('businesses', conn.conn, if_exists='append', flavor='mysql', index=False) engine = create_engine("mysql+mysqldb://ipd:thanks@localhost/IPD_data") data.to_sql('businesses', con=engine, if_exists='append', index=False, index_label=None)

hrmnngth avatar May 04 '18 16:05 hrmnngth