I'm trying to write into SQLite database from R. The dataframe "ExportableData" has the following format:
<html>
<body>
<table>
<tr>
<td> Date </td> <td> Name </td> <td> value</td>
</tr>
<tr>
<td>2015-11-15 </td> <td> ABCD</td> <td> 999</td>
</tr>
</table>
</body>
</html>
The connection is using RODBC package ch <- RODBC::odbcConnect(dsn="test", believeNRows=FALSE)
If I run
`sqlSave(mdbConnect, ExportableData, rownames = 0, addPK=TRUE)`
It occurs error saying [RODBC] ERROR: Could not SQLExecDirect 'CREATE TABLE "ExportableData"...
I'm able to fix this error by opening SQLite "test" database and adding a constraint, specifying column "Date" and "Name" to be the primary key. But by this method, the RODBC writing process is extremely slow compared with writing into Access database. Eg, write into SQLite for 1000 records would take 1.6 minutes while into Access it only takes 20 seconds. Any suggestion on how to solve or expedite the process is much appreciated.
Aucun commentaire:
Enregistrer un commentaire