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

Make list_relations_without_caching pagination configurable #1235

Merged
merged 6 commits into from
Nov 18, 2024

Conversation

mikealfare
Copy link
Contributor

@mikealfare mikealfare commented Nov 7, 2024

resolves #1234

Problem

Some users have over 100K objects in a single schema. We need to paginate results from show objects since that call is limited to 10K objects by Snowflake. We hard coded this result to 10 pages. However this doesn't allow users to have more than 100K objects in their schema. In this scenario, users are hit with an error that blocks dbt from running anything.

Solution

Allow users to configure the pagination using project flags. They can configure both the number of results per page as well as the number of pages. This defaults to the current setting of 10000 results per page and 10 pages if the flags are not passed in. Example:

# dbt-project.yml
flags:
  list_relations_per_page: 10000
  list_relations_page_limit: 100

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

@mikealfare mikealfare requested a review from a team as a code owner November 7, 2024 22:02
@cla-bot cla-bot bot added the cla:yes label Nov 7, 2024
Copy link
Contributor

github-actions bot commented Nov 7, 2024

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the dbt-snowflake contributing guide.

@mikealfare mikealfare self-assigned this Nov 8, 2024
matthewshaver added a commit to dbt-labs/docs.getdbt.com that referenced this pull request Nov 8, 2024
## What are you changing in this pull request and why?

Closes dbt-labs/dbt-snowflake#1235

## Checklist
- [ ] I have reviewed the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
so my content adheres to these guidelines.
- [ ] The topic I'm writing about is for specific dbt version(s) and I
have versioned it according to the [version a whole
page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
and/or [version a block of
content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content)
guidelines.
- [ ] I have added checklist item(s) to this list for anything anything
that needs to happen before this PR is merged, such as "needs technical
review" or "change base branch."
- [ ] The content in this PR requires a dbt release note, so I added one
to the [release notes
page](https://docs.getdbt.com/docs/dbt-versions/dbt-cloud-release-notes).
<!--
PRE-RELEASE VERSION OF dbt (if so, uncomment):
- [ ] Add a note to the prerelease version [Migration
Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade)
-->
<!-- 
ADDING OR REMOVING PAGES (if so, uncomment):
- [ ] Add/remove page in `website/sidebars.js`
- [ ] Provide a unique filename for new pages
- [ ] Add an entry for deleted pages in `website/vercel.json`
- [ ] Run link testing locally with `npm run build` to update the links
that point to deleted pages
-->

<!-- vercel-deployment-preview -->
---
🚀 Deployment available! Here are the direct links to the updated files:


-
https://docs-getdbt-com-git-snowflake-pagination-dbt-labs.vercel.app/reference/resource-configs/snowflake-configs

<!-- end-vercel-deployment-preview -->

---------

Co-authored-by: Amy Chen <[email protected]>
Copy link
Contributor

@VersusFacit VersusFacit left a comment

Choose a reason for hiding this comment

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

More curious here than anything else: is there any real cost on this test from building all of these views? I imagine it's quite like since we're not actually running anything per se.

@mikealfare mikealfare deleted the add-config-for-list-relations-limit branch November 9, 2024 01:59
@mikealfare mikealfare restored the add-config-for-list-relations-limit branch November 18, 2024 17:06
@mikealfare
Copy link
Contributor Author

I think this got accidentally closed with the docs PR.

@mikealfare mikealfare reopened this Nov 18, 2024
@mikealfare mikealfare merged commit 7c63a40 into main Nov 18, 2024
37 checks passed
@mikealfare mikealfare deleted the add-config-for-list-relations-limit branch November 18, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes user docs [docs.getdbt.com] Needs better documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] dbt-snowflake raises an error when caching less than the maximum number of objects in a schema
3 participants