Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusSkytte committed Mar 15, 2024
1 parent f0894e5 commit 34d5cc2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ jobs:
with:
extra-packages: any::devtools

- name: Run benchmark (SQLite)
if: always()
env:
BACKEND: SQLite
BACKEND_DRV: RSQLite::SQLite
BACKEND_ARGS: 'list(dbname = file.path(tempdir(), "SQLite.SQLite"))'
run: source("./data-raw/benchmark_update_snapshot.R", echo=TRUE)
shell: Rscript {0}
# - name: Run benchmark (SQLite)
# if: always()
# env:
# BACKEND: SQLite
# BACKEND_DRV: RSQLite::SQLite
# BACKEND_ARGS: 'list(dbname = file.path(tempdir(), "SQLite.SQLite"))'
# run: source("./data-raw/benchmark_update_snapshot.R", echo=TRUE)
# shell: Rscript {0}

- name: Run benchmark (DuckDB)
if: always()
Expand Down
16 changes: 7 additions & 9 deletions R/create_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,13 @@ create_scdb_index.SQLiteConnection <- function(conn, db_table_id) {

#' @noRd
create_scdb_index.DBIConnection <- function(conn, db_table_id) {
schema <- purrr::pluck(db_table_id, "name", "schema")
table <- purrr::pluck(db_table_id, "name", "table")

index <- paste(c(shQuote(schema), shQuote(paste0(table, '_scdb_index'))), collapse = '.')

DBI::dbExecute(
conn,
glue::glue(
"CREATE UNIQUE INDEX {index} ON {as.character(db_table_id, explicit = TRUE)} (checksum, from_ts)"
)
query <- glue::glue(
"CREATE UNIQUE INDEX {stringr::str_replace_all(paste0(db_table_id, '_scdb_index'), stringr::fixed('.'), '_')} ",
"ON {as.character(db_table_id, explicit = TRUE)} (checksum, from_ts)"
)

print(query)

DBI::dbExecute(conn, query)
}

0 comments on commit 34d5cc2

Please sign in to comment.