Nimbus
Nimbus

Reputation: 1

python - MariaDB "unknown column in field" issue

So I've succeeded in saving the python query result into csv files so far. It was all good.

But I'm now struggling with saving the result into MariaDB.

The dataframe that keeps showing error messages whenever I try to save it into MariaDB

What I can't really understand is that there is no problem saving the same data when setting the time as '2017-02-01 to 2020-04-20', but the error message sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1054, "Unknown column 'inf' in 'field list'") pops up when I switch the starting timeline any date before 2017-02-01 (e.g. timeframe as '2015-06-15 to 2020-04-20') even though I have the data starting from 2015-08-21.

The dataframe well saved into MariaDB

As you can see the dataframe starting from 2007-02-01 which has been transmitted to MariaDB without any problem, I have no column named 'inf' either in the python dataframe or the SQL table.

[SQL: INSERT INTO equitiesdailyprice (`Quote`, `Date`, `Close`, `PriceDiff`, `Volume`, `VolDiff`, `Open`, `High`, `Low`) 
VALUES (%(Quote)s, %(Date)s, %(Close)s, %(PriceDiff)s, %(Volume)s, %(VolDiff)s, %(Open)s, %(High)s, %(Low)s)]

Upvotes: 0

Views: 730

Answers (1)

vy32
vy32

Reputation: 29677

The problem is that inf is internally floating point infinity, and your python connector (possibly pymysql?) is converting this to inf, and MariaDB doesn't know how to represent infinity in a column.

Upvotes: 1

Related Questions