5
$\begingroup$

I want to store JSON Data into MySQL Database using Python. I used dataframe of pandas. I found that to_sql() can do this job easily.

Python Code:

jdata=json.loads(json_data)
df=pandas.DataFrame(jdata)
df.to_sql(con=con, name='crashTable', if_exists='replace', flavor='mysql')

Output:

TypeError: to_sql() got an unexpected keyword argument 'flavor'

I got this error message. How to resolve this error?

$\endgroup$

1 Answer 1

7
$\begingroup$

Based on the documentation 0.22 and 0.24.1, the flavor does not exist in the argument list of the to_sql method. You're probably running the 0.24.1 version which does not need flavor argument.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.