Skip to main content
added 253 characters in body
Source Link
Argent
  • 955
  • 2
  • 10
  • 21

I have been able to cobble together a workaround:

  1. Write the data frame that you want to append as a temporary table (temp) in the SQLite database file.

  2. Append it to the target table (target) using the SQLite statement:

    insert into target select * from temp;

  3. Drop temp.

This runs quite fast, presumably thanks to SQLite being well optimized.

ADDENDUM:

You can indeed append a data frame to a database table using dbWriteTable, with the option append=TRUE. I have tested this against my workaround described above and, surprisingly, the workaround runs almost 40% faster than dbWriteTable.

I have been able to cobble together a workaround:

  1. Write the data frame that you want to append as a temporary table (temp) in the SQLite database file.

  2. Append it to the target table (target) using the SQLite statement:

    insert into target select * from temp;

  3. Drop temp.

This runs quite fast, presumably thanks to SQLite being well optimized.

I have been able to cobble together a workaround:

  1. Write the data frame that you want to append as a temporary table (temp) in the SQLite database file.

  2. Append it to the target table (target) using the SQLite statement:

    insert into target select * from temp;

  3. Drop temp.

This runs quite fast, presumably thanks to SQLite being well optimized.

ADDENDUM:

You can indeed append a data frame to a database table using dbWriteTable, with the option append=TRUE. I have tested this against my workaround described above and, surprisingly, the workaround runs almost 40% faster than dbWriteTable.

Source Link
Argent
  • 955
  • 2
  • 10
  • 21

I have been able to cobble together a workaround:

  1. Write the data frame that you want to append as a temporary table (temp) in the SQLite database file.

  2. Append it to the target table (target) using the SQLite statement:

    insert into target select * from temp;

  3. Drop temp.

This runs quite fast, presumably thanks to SQLite being well optimized.