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

Retain ordinal position of columns in get_columns_in_table method #606

Closed
haylo75 opened this issue Nov 28, 2017 · 3 comments
Closed

Retain ordinal position of columns in get_columns_in_table method #606

haylo75 opened this issue Nov 28, 2017 · 3 comments
Labels
enhancement New feature or request

Comments

@haylo75
Copy link

haylo75 commented Nov 28, 2017

The result set for the default adapter's get_columns_in_table method returns columns unordered. In customizing dbt for my own use, I found it much easier to retain the original ordinal position. Debugging was simpler as I could compare directly to my database tool without mental friction.

This would be simple to implement, around line 188 in dbt/adapters/default.py

https://github.com/fishtown-analytics/dbt/blob/f039bb632df17b0cd2cf81b32b6d8366cb17b980/dbt/adapters/default.py#L188

Something like:
sql += "\norder by ordinal_position"

@drewbanin
Copy link
Contributor

Good idea -- I think this should be pretty straightforward to add. Also need to figure out the analogues for snowflake and bigquery

@drewbanin drewbanin added the enhancement New feature or request label Nov 28, 2017
@haylo75
Copy link
Author

haylo75 commented Nov 28, 2017

Cool - I should've mentioned that I didn't see this method overridden in the subclassed adapters. I assumed that, since the other PostgresAdapter derived adapters are using information_schema.columns, then the ordinal_position metacolumn was available in those platforms.

@haylo75
Copy link
Author

haylo75 commented Apr 26, 2018

yasss, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants