Opt-in to handle errors caused by long comments on tables#9
Merged
Dipesh Prajapati (chelsea76) merged 1 commit intomasterfrom Jun 27, 2024
Merged
Opt-in to handle errors caused by long comments on tables#9Dipesh Prajapati (chelsea76) merged 1 commit intomasterfrom
Dipesh Prajapati (chelsea76) merged 1 commit intomasterfrom
Conversation
Dipesh Prajapati (chelsea76)
approved these changes
Jun 27, 2024
Satish Aher (satishaher)
approved these changes
Jun 27, 2024
Zoran Pesic (zokioki)
added a commit
to doximity/odbc_adapter
that referenced
this pull request
Aug 30, 2024
… comments This change fixes an issue with the `tables` call erroring out if attempting to fetch any tables that have longer than 254 character comments on them. This fix is based on the approach used by the patterninc fork of the gem, whose PR does a great job of explaining the issue and idea behind the solution: > The fetch_all function is using a bound 'remarks' column that is configured to > have a max_length of 254 characters. That max length is not configurable and the > column cannot be unbound. So when a table with a comment longer than 254 characters > exists in the result set, we run into the negative string size (or size too big) error. - patterninc#9 The primary difference here is that we're using `SHOW TABLES IN ACCOUNT` query, which should return the same set of tables as `fetch_all` was returning before, eliminating the need for an opt-in config flag. Snowflake docs on the SHOW TABLES query: https://docs.snowflake.com/en/sql-reference/sql/show-tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow clients to opt-in to handling long-comment tables by using a
SHOW TABLESquery. Thefetch_allfunction is using a bound 'remarks' column that is configured to have a max_length of 254 characters. That max length is not configurable and the column cannot be unbound. So when a table with a comment longer than 254 characters exists in the result set, we run into thenegative string size (or size too big)error.This change uses a
show tablesquery which generates a comment column definition with the max length allowed in snowflake. This allows us to pull down tables with any size comment. Since the result set is different between theshow tablesquery and thefetch_allfunction on the tables ODBC:Statement object, the application must opt-in to using this functionality by definingsilo_fetch_all_tablesin the database.yml file (see below).