Skip to content

Commit

Permalink
Sysobjects qry fix (#66)
Browse files Browse the repository at this point in the history
* SQL comment wrapping error

* fix show tables ut
  • Loading branch information
tomwilsonsco authored Oct 4, 2024
1 parent 86b6ac0 commit ff016fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion R/show_schema_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ table_sql <- function(schema) {
order by 2;", .con = DBI::ANSI())
}

# type IN ('U', 'V') = user tables, views
table_view_sql <- function(schema) {
glue::glue_sql("SELECT name AS 'table', \\
type_desc AS 'object_type', \\
create_date AS 'creation_date' \\
FROM sys.objects \\
WHERE type IN ('U', 'V') -- 'U'ser tables, 'V'iews \\
WHERE type IN ('U', 'V') \\
AND SCHEMA_NAME(schema_id) = {schema} \\
order by type, name;", .con = DBI::ANSI())
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-show_schema_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test_that("table and view sql created correctly", {
type_desc AS 'object_type', \\
create_date AS 'creation_date' \\
FROM sys.objects \\
WHERE type IN ('U', 'V') -- 'U'ser tables, 'V'iews \\
WHERE type IN ('U', 'V') \\
AND SCHEMA_NAME(schema_id) = 'test_schema' \\
order by type, name;")

Expand Down

0 comments on commit ff016fd

Please sign in to comment.