Skip to content

Commit 41f3238

Browse files
authored
Merge pull request #3 from npelikan/r-generic-datasource
example update
2 parents 721be92 + 48503f0 commit 41f3238

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

r-package/DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Encoding: UTF-8
3131
Roxygen: list(markdown = TRUE)
3232
RoxygenNote: 7.3.2
3333
Suggests:
34+
DT,
3435
RSQLite,
3536
testthat (>= 3.0.0)
3637
Config/testthat/edition: 3

r-package/examples/app-database.R

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,21 @@ conn <- dbConnect(RSQLite::SQLite(), temp_db)
1313
iris_data <- iris
1414
dbWriteTable(conn, "iris", iris_data, overwrite = TRUE)
1515

16-
# Create another sample table
17-
mtcars_data <- mtcars[1:20, ] # First 20 rows for demo
18-
dbWriteTable(conn, "mtcars", mtcars_data, overwrite = TRUE)
19-
2016
# Disconnect temporarily - we'll reconnect in the app
2117
dbDisconnect(conn)
2218

2319
# Define a custom greeting for the database app
2420
greeting <- "
2521
# Welcome to the Database Query Assistant! 📊
2622
27-
I can help you explore and analyze data from the connected database.
28-
Ask me questions about the iris or mtcars datasets, and I'll generate
29-
SQL queries to get the answers.
23+
I can help you explore and analyze the iris dataset from the connected database.
24+
Ask me questions about the iris flowers, and I'll generate SQL queries to get the answers.
3025
3126
Try asking:
3227
- Show me the first 10 rows of the iris dataset
3328
- What's the average sepal length by species?
34-
- Which cars have the highest miles per gallon?
35-
- Create a summary of the mtcars data grouped by number of cylinders
29+
- Which species has the largest petals?
30+
- Create a summary of measurements grouped by species
3631
"
3732

3833
# Create database source
@@ -44,7 +39,7 @@ iris_source <- database_source(db_conn, "iris")
4439
querychat_config <- querychat_init(
4540
data_source = iris_source,
4641
greeting = greeting,
47-
data_description = "This database contains the famous iris flower dataset with measurements of sepal and petal dimensions across three species, and a subset of the mtcars dataset with automobile specifications.",
42+
data_description = "This database contains the famous iris flower dataset with measurements of sepal and petal dimensions across three species (setosa, versicolor, and virginica).",
4843
extra_instructions = "When showing results, always explain what the data represents and highlight any interesting patterns you observe."
4944
)
5045

@@ -58,11 +53,11 @@ ui <- page_sidebar(
5853
h3("Current SQL Query"),
5954
verbatimTextOutput("sql_query"),
6055
br(),
61-
h3("Available Tables"),
56+
h3("Dataset Information"),
6257
p("This demo database contains:"),
6358
tags$ul(
6459
tags$li("iris - Famous iris flower dataset (150 rows, 5 columns)"),
65-
tags$li("mtcars - Motor car specifications (20 rows, 11 columns)")
60+
tags$li("Columns: Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species")
6661
)
6762
)
6863

0 commit comments

Comments
 (0)