-
Notifications
You must be signed in to change notification settings - Fork 84
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
Found more than one class "Microsoft SQL Server" in cache; using the first, from namespace '.GlobalEnv' #224
Comments
Yes, I looked at this. Unfortunately, |
Ok just wanted to report this. I'm not sure if it causes any real problems. Feel free to close it if there's nothing to be done. |
Weird. I see the warning ("Found more than one class..."), but not the error message, and I can use the I'll try to see if I can mimic |
I have a first attempt in the dynamic_inheritance branch. The warning (and probably error) should be gone when using The error does return when Could you give the current version in dynamic_inheritance a try? (Check is currently throwing some warnings about missing documentation, but should not prevent testing) |
What if we tried adding a DatabaseConnector translation method to dbplyr? It could do the same thing as sql server but wouldn't overwrite the class. The idea would be for dbplyr to generate generic OHDSI-SQL which would then get translated by sql render? I'll try the dynamic inheritance branch. |
I like the idea of adding a OhdsiSql backend to dbplyr. I'm also thinking about the future of DatabaseConnector in general. I would like it to become more and more lightweight, as the DBI drivers are becoming more and more mature and consistent with each other. DatabaseConnector should just be there to fix the last annoying incompatibility issues between drivers, not duplicate what is already there. So perhaps we may not need an OhdsiSql backend in the end (this dynamic inheritance might allow us to use the various native backends instead of SQL translation). Just thinking out loud... |
This issue seems to be fixed in the dynamic_inheritance branch. Thank you!! library(DatabaseConnector)
con <- DBI::dbConnect(odbc::odbc(),
Driver = Sys.getenv("SQL_SERVER_DRIVER"),
Server = Sys.getenv("CDM5_SQL_SERVER_SERVER"),
Database = Sys.getenv("CDM5_SQL_SERVER_CDM_DATABASE"),
UID = Sys.getenv("CDM5_SQL_SERVER_USER"),
PWD = Sys.getenv("CDM5_SQL_SERVER_PASSWORD"),
TrustServerCertificate="yes",
Port = 1433)
DBI::dbDisconnect(con) Created on 2023-08-09 with reprex v2.0.2 |
I'm seeing
Found more than one class "Microsoft SQL Server" in cache; using the first, from namespace '.GlobalEnv'
printed a whole lot.I think this is because the "Microsoft SQL Server" class is defined in two different packages that I have installed, DatabaseConnector and odbc.
My sense is that it is not a good idea to export a class that is also exported by another package but I could be wrong.
Defintion in DatabaseConnector:
DatabaseConnector/R/DBI.R
Line 68 in 5176e98
DatabaseConnector/NAMESPACE
Line 51 in 5176e98
Defintion in odbc:
https://github.com/r-dbi/odbc/blob/7cdeac8af11b5d304493dcdda82c3d4f63ca3452/R/db.R#L98
Does not look like odbc exports this class though...
https://github.com/r-dbi/odbc/blob/main/NAMESPACE
All I know for sure is that this message is getting printed a lot.
The text was updated successfully, but these errors were encountered: