Skip to content

Commit

Permalink
move force statement in sample sql to sql preview api
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Jun 11, 2018
1 parent 77b2d29 commit 8e40405
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/cpp/session/modules/SessionDataPreview.R
Expand Up @@ -44,6 +44,9 @@
# remove comments since some drivers might not support them
statement <- gsub("--[^\n]*\n+", "", statement)

# force the connection to let DBI and others initialize S3
conn <- force(conn)

# fetch at most 100 records as a preview
rs <- DBI::dbSendQuery(conn, statement = statement, ...)
data <- DBI::dbFetch(rs, n = 1000)
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/session/resources/templates/query.sql
@@ -1,3 +1,3 @@
-- !preview conn=force(DBI::dbConnect(RSQLite::SQLite()))
-- !preview conn=DBI::dbConnect(RSQLite::SQLite())

SELECT 1

0 comments on commit 8e40405

Please sign in to comment.