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

ENH: New internal dm_meta() for learning a data model from the database, for now for SQL Server only (#342) #517

Merged
merged 87 commits into from
May 28, 2022

Conversation

krlmlr
Copy link
Collaborator

@krlmlr krlmlr commented Apr 29, 2021

Part of #342.

@krlmlr
Copy link
Collaborator Author

krlmlr commented Mar 31, 2022

@TSchiefer: This is as good as it gets in this iteration. Let's file follow-up tickets. What do we need to change before merging?

TSchiefer
TSchiefer previously approved these changes Mar 31, 2022
Copy link
Member

@TSchiefer TSchiefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great.
I didn't go through every detail, but the behavior is nice.

Shall we also already use dm_meta() for learning from PG in this PR?
I tried it for both learning from a specific schema and without providing a schema name. It works great when providing a schema name, but I think we could filter out some or all of the non-user tables when not learning from a specific schema(?)

"constraint_schema",
"constraint_type",
"dbname",
"FIXME",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional?

df_info <-
info %>%
dm_select_tbl(-schemata) %>%
collect()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collect() is already done at the end of dm_meta()

if (is_mssql(con)) {
if (is.null(catalog)) {
# FIXME: Classed error message?
abort("SQL server only supports learning from one database.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

classed error msg in follow-up PR?

@@ -41,6 +41,130 @@ dm_learn_from_db <- function(dest, dbname = NULL, ...) {
return()
}

if (!is_mssql(con)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, dm_meta() works well for PG too. We could learn from PG using the function as well in this PR.

@TSchiefer
Copy link
Member

I forgot: should we also add a direct test for dm_meta() (and maybe even for some of its helper functions?)? In a future PR?

@krlmlr krlmlr added this to the 0.2.8 milestone Apr 7, 2022
@krlmlr krlmlr changed the title Draft dm_meta() ENH: Draft dm_meta() May 12, 2022
@krlmlr krlmlr changed the title ENH: Draft dm_meta() ENH: New internal dm_meta() for learning a data model from the database, for now for SQL Server only May 28, 2022
@krlmlr krlmlr changed the title ENH: New internal dm_meta() for learning a data model from the database, for now for SQL Server only ENH: New internal dm_meta() for learning a data model from the database, for now for SQL Server only (#342) May 28, 2022
@krlmlr krlmlr merged commit 096739e into main May 28, 2022
@krlmlr krlmlr deleted the f-learn-compound-mssql branch May 28, 2022 06:32
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants