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

feat: add metastore loader config #1134

Merged
merged 4 commits into from
Jan 25, 2023
Merged

Conversation

jczhong84
Copy link
Collaborator

As we may sync more metadata types from metastore, like owners, tags, here we are adding a config for the metastore loader so that we can manage whether the metadata should be read-only or written back to metastore.

By default, it will keep the current behavior, which is only writing into querybook db.

@jczhong84 jczhong84 requested a review from czgu January 24, 2023 01:36


class MetadataMode(Enum):
READ_ONLY = "read_only" # metadata will be read-only on Querybook UI
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this also include option for it will be editable and only saved in qurybook db or that is writeback?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My thought was: if a metadata type key is not in the loader config, then it will be editable and only saved in querybook db, which is today's behavior.

I can also add another option for it, and make it default
read_only:
write_back: default
write_through: write to querybook db and also write back to metastore

querybook/server/datasources/metastore.py Outdated Show resolved Hide resolved
verify_metastore_permission(metastore_id)
metastore_loader = get_metastore_loader(metastore_id)

return metastore_loader.get_metastore_link(
Copy link
Collaborator

Choose a reason for hiding this comment

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

need to validate if metastore_loader indeed is in read only mode for that metadata type

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought it over, perhaps we dont need to restrict the metastore link only for read-only mode . The metastore link exists no matter it's read-only or not, but as long as there is a link. For now, we only use it for redirection. but maybe we could still put the link some where even when it will write back to the metastore.

querybook/server/models/admin.py Show resolved Hide resolved
querybook/webapp/const/metastore.ts Outdated Show resolved Hide resolved
# Metadata will be read-only on Querybook UI and it will redirect to the metastore link for editing.
READ_ONLY = "read_only"

# On saving, metadata will only be written back querybook db. This is the default mode if not specified.
Copy link
Collaborator

Choose a reason for hiding this comment

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

the default value in MetastoreLoaderConfig is None, can you put some way to associate WRITE_BACK if no value is provided for the entity?

Copy link
Collaborator

Choose a reason for hiding this comment

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

also WRITE_BACK sounds like it is going to write back to the metastore, maybe WRITE_LOCAL or WRITE_QUERYBOOK_ONLY?

table_id,
metadata_type,
):
with DBSession() as session:
Copy link
Collaborator

Choose a reason for hiding this comment

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

session is not needed for API, its automatic

COLUMN_DESCRIPTION = "column_description"
OWNER = "owner"
TAG = "tag"
DOMAIN = "domain"
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets remove DOMAIN in this PR for now, since this metadata entity does not actually exist.
Once we do treat domain as something in querybook, we can add it back in

@czgu czgu merged commit d0c0270 into pinterest:master Jan 25, 2023
@jczhong84 jczhong84 deleted the feat/loader branch April 7, 2023 00:41
rohan-sh1 pushed a commit to CAI-TECHNOLOGIES/cai-ext-db-explorer that referenced this pull request Apr 11, 2023
* feat: add metastore config

* comments

* rename

* remove session
aidenprice pushed a commit to arrowtail-precision/querybook that referenced this pull request Jan 3, 2024
* feat: add metastore config

* comments

* rename

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

Successfully merging this pull request may close these issues.

None yet

2 participants