I have one strange issue here with importing data to SQLite db. So here is the story. I use Dataframe.to_sql multiple time in past with no issues. Now I have this issue and cannot find the source of it: Dataframe.to_sql import the integer data as bite only for defined columns and only in first line of import.
I checked pandas dataframe and it is correct (by print it, save to .csv –> nothing has bite value for integer)
Details: here is pandas Dataframe with index:
;Category_ID;Pattern_ID;Pattern_Order;Pattern_1;Pattern_Counter
0;0;1;0;**1;129**
1;0;1;1;2;138
2;0;1;2;3;122
3;0;1;3;4;122
4;0;1;4;5;152
5;0;1;5;6;149
6;0;1;6;7;142
7;0;1;7;8;137
8;0;1;8;9;141
9;0;1;9;10;138
10;0;1;10;11;122
11;0;1;11;12;138
12;0;1;12;13;160
13;0;1;13;14;155
14;0;1;14;15;138
15;0;1;15;16;153
16;0;1;16;17;137
17;0;1;17;18;133
18;0;1;18;19;144
19;0;1;19;20;128
20;0;1;20;21;151
21;0;1;21;22;152
22;0;1;22;23;145
23;0;1;23;24;165
24;0;1;24;25;142
25;0;1;25;26;159
26;0;1;26;27;142
27;0;1;27;28;141
28;0;1;28;29;152
29;0;1;29;30;137
30;0;1;30;31;159
31;0;1;31;32;122
32;0;1;32;33;159
33;0;1;33;34;133
–> I higlighetd by bold only those values which are converted to bite and imported as bite.
here is result:
**Code I use for import: **
Table = Table_Name
conn = connect(database=f"{database}.sqlite")
cursor = conn.cursor()
DataFrame.to_sql(name=Table, con=conn, if_exists="append", index=False, chunksize=100)
conn.commit()
cursor.close()
conn.close()
Addtionaly here is print of dtypes of pandas:
Category_ID object
Pattern_ID object
Pattern_Order object
Pattern_1 object
Pattern_Counter object
MY question: Does any of you anytime experience similar situation?
I would like to have some help finding the reason why the bite is saved to sqlite instead of original int value.
1