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
Do not rename columns in generated JOINs unless necessary #20
Comments
Library generates class with all new columns names grouped by tables from view Class name like ClassNameSchema2 |
I know, but sometimes one really have to hardcode them in several places. E.g. I have a following method in my code (taken from this SO answer):
It is used in queries to several tables/views, so I have to either write lots of SQL manually or do complex manipulations with column names to make it work with AnnotatedSQL. |
Ok, I have notices that |
Right now AnnotatedSQL mangles column names during joins by appending "as table_name___column_name" to each column in generated SELECT statement, e.g.
While occasionally useful and more mistake-proof, this prevents hardcoding column names in really complex statements. Instead the generator should check for duplicate names and rename columns only when necessary. For most purposes it should be enough to maintain a single global list of names and rename columns when any two tables have column with the same name. Otherwise just keep old names.
Hopefully, this won't not introduce any breakage, but just in case you can leave old behavior by default and make it toggleable with apt option.
The text was updated successfully, but these errors were encountered: