When I write Pandas DataFrame to my SQLite database using to_sql method it changes the .schema
of my table even if I use if_exists='append'
. For example after execution
with sqlite3.connect('my_db.sqlite') as cnx:
df.to_sql('Resolved', cnx, if_exists='append')
original .schema
:
CREATE TABLE `Resolved` (
`Name` TEXT NOT NULL COLLATE NOCASE,
`Count` INTEGER NOT NULL,
`Obs_Date` TEXT NOT NULL,
`Bessel_year` REAL NOT NULL,
`Filter` TEXT NOT NULL,
`Comments` TEXT COLLATE NOCASE
);
changes to:
CREATE TABLE Resolved (
[Name] TEXT,
[Count] INTEGER,
[Obs_Date] TEXT,
[Bessel_year] REAL,
[Filter] TEXT,
[Comments] TEXT
);
How to save the original scheme of my table? I use pandas 0.14.0, Python 2.7.5