Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have synonyms show-up for Microsoft SQL Server dbListTables #221

Open
ghost opened this issue Oct 1, 2018 · 7 comments · May be fixed by #773
Open

Have synonyms show-up for Microsoft SQL Server dbListTables #221

ghost opened this issue Oct 1, 2018 · 7 comments · May be fixed by #773
Labels
feature a feature request or enhancement mssql Microsoft SQL Server
Milestone

Comments

@ghost
Copy link

ghost commented Oct 1, 2018

@brshallo commented on May 7, 2018, 5:21 PM UTC:

I regularly connect to data marts provisioned for me on Microsoft SQL Server.

When connecting to Microsoft SQL Server, the RStudio "Connections" tab shows "tables" and "views" but does not show "synonyms". ("Synonyms" also do not show-up when running DBI::dbListTables(con))

If I want to view the synonyms in R I will typically do something like:

library(tidyverse)
xtypes <- c("V", "SN", "U")
tables_access <- tbl(con, "sysobjects") %>% 
  select(name, xtype) %>% 
  collect() %>%
  filter(str_detect(xtype, "V|SN|U"))

View(tables_access)

Though this is less convenient. The ability to connect and query synonyms is unaffected. Only the ability to preview tables via DBI::dbListTables / the Connections tab, and only for Microsoft SQL Server.

Right now I end-up usually using Tableau's data previewer in parallel (which I believe is using the same driver but defaults to show synonyms as well as views and tables)...

If it does not make sense to have synonyms show-up by default in the package, do you know what change to options i can make that would make 'synonyms' show-up in my 'Connections' pane in RStudio when connecting to Databases on Microsoft SQL Server?

System details

RStudio Edition : Desktop
RStudio Version :  1.1.282
OS Version      :  Windows 10 Enterprise, x64-based processor
R Version       :  R version 3.4.2 (2017-09-28)

Packages:

dbi pacakge version: 0.8
driver: "SQL Server"

The same thing occurs whether I'm connecting via windows authentication or with a specific username and password with odbc. The lack of synonyms showing-up when running DBI::dbListTables also occurs whether I'm using odbc or RJDBC for connecting.

This issue was moved by krlmlr from r-dbi/DBI#244.

@ghost
Copy link
Author

ghost commented Oct 1, 2018

@brshallo commented on Aug 6, 2018, 2:25 PM UTC:

Would this be more appropriate under odbc as this is what currently drives the viewer?

@ghost
Copy link
Author

ghost commented Oct 1, 2018

@krlmlr commented on Aug 26, 2018, 8:32 PM UTC:

@jimhester: Is it possible to add support for synonyms to odbc?

@ghost
Copy link
Author

ghost commented Oct 1, 2018

@brshallo commented on Sep 4, 2018, 5:54 PM UTC:

@krlmlr @jimhester note I can still query a synonym, e.g.

tbl(con, "SYN_NAME") %>% collect()

Though the SYN_NAME does not show-up in Rstudio's preview pane nor does it show-up when running dbListTables.

When I run odbc::odbcListObjectTypes(con) I get the following:

$`catalog`
$`catalog`$`contains`
$`catalog`$`contains`$`schema`
$`catalog`$`contains`$`schema`$`contains`
$`catalog`$`contains`$`schema`$`contains`$`table`
$`catalog`$`contains`$`schema`$`contains`$`table`$`contains`
[1] "data"

$`catalog`$`contains`$`schema`$`contains`$view
$`catalog`$`contains`$`schema`$`contains`$view$`contains`
[1] "data"

(Synonyms do not show-up.)

@ghost
Copy link
Author

ghost commented Oct 1, 2018

@jimhester commented on Sep 4, 2018, 7:54 PM UTC:

Yes, it is likely possible to add support for this, but we should move this issue to odbc.

@ghost
Copy link
Author

ghost commented Oct 1, 2018

@krlmlr commented on Oct 1, 2018, 9:47 AM UTC:

/move to odbc

@krlmlr krlmlr added the mssql Microsoft SQL Server label Jan 8, 2019
@jimhester jimhester added the feature a feature request or enhancement label Nov 14, 2019
@brshallo
Copy link

brshallo commented Feb 9, 2021

Any updates on this? Or any tips on how I might edit a connection object to show synonyms?

@jimhester
Copy link
Contributor

You would have to define a odbcListObjects method for SQL Server that queried the synonyms and included them in the results I guess.

@hadley hadley added this to the v1.4.0 milestone Apr 24, 2023
@hadley hadley modified the milestones: v1.4.0, v1.5.0 Dec 14, 2023
@simonpcouch simonpcouch linked a pull request Mar 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement mssql Microsoft SQL Server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants