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

How to modify keys of a dm from connection? #2202

Closed
asadow opened this issue Mar 11, 2024 · 3 comments
Closed

How to modify keys of a dm from connection? #2202

asadow opened this issue Mar 11, 2024 · 3 comments

Comments

@asadow
Copy link

asadow commented Mar 11, 2024

Adding a table is described at this page.

But the keys are added after copy_to(), meaning that the keys don't apply to the connection dm, only the locally defined.

@krlmlr
Copy link
Collaborator

krlmlr commented Nov 24, 2024

Thanks, missed that. What section does your question refer to?

@asadow
Copy link
Author

asadow commented Jan 2, 2025

Closing as I can't easily reprex this:

> library(dm)
> library(dbplyr)
> 
> fin_dm <-
+   dm_financial() %>%
+   dm_select_tbl(-trans) %>%
+   collect()
Error in `financial_db_con()`:
! Can't connect to relational.fit.cvut.cz or databases.pacha.dev:
Failed to connect: Can't connect to server on 'relational.fit.cvut.cz' (138)
Failed to connect: Can't connect to server on 'databases.pacha.dev' (138)
Run `rlang::last_trace()` to see where the error occurred.

@asadow asadow closed this as completed Jan 2, 2025
@krlmlr
Copy link
Collaborator

krlmlr commented Jan 3, 2025

Do you need to upgrade the dm package to fix dm_financial() ?

Anyway, there are two possibilities: either information on foreign keys is stored on the database (in which case you can use dm_from_con() to "learn" a dm with that information), or not (and then you need to dm_add_pk() and dm_add_fk() after dm_from_con() ) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants