News for hackers. Stuff that matters.
Re:Please put units in names by Closi on Monday March 21, 2022 @10:59AM (#30754869)
How do you write code so that it can accommodate DB field name changes without breaking SQL reports / BI?

Might be easy if you own the whole codebase and all reporting, but you are also going to break all those linked BI reports that the analysis team has written.

Re:Please put units in names by Too on Monday March 21, 2022 @01:30PM (#30757123)
Breaking the report is a feature.

If you don’t, it will assume kmph instead of mph and just present the wrong data! But sure…those graphs still look pretty…

Re:Please put units in names by Closi on Monday March 21, 2022 @07:22PM (#30761007)
Which links back to the original point from quickthrower that database field name changes are really hard to change then.

If you can’t make a change without it potentially breaking other stuff, it goes in the “not easy” category for me. Especially if you probably won’t know if stuff is broken until the change is pushed to prod.

Re:Please put units in names by im3w1l on Monday March 21, 2022 @03:17PM (#30758475)
Create a new column speed_mph. Create a trigger that makes writes to either column gets written to both (make sure to write it to avoid infinite recursion). Copy all data from speed_kmph to speed_mph. Deprecate speed_kmph. Change existing usages at your leisure. Delete speed_kmph.
Re:Please put units in names by gilcot on Tuesday March 22, 2022 @07:56PM (#30773169)
You can't just copy data, it's said to be they're factor k (i.e. 10^3) hahaha Even switching to "speed_mph" still makes the warning/comment relevant: that just means that "m" is for "miles" and not "meters"
Re:Please put units in names by Closi on Tuesday March 22, 2022 @03:52AM (#30763618)
Fair enough, although sounds like it’s really hard to change then back to quickthrowers point.
Re:Please put units in names by pojzon on Monday March 21, 2022 @12:53PM (#30756464)
Most often those reports are built on top of table views and not direct table contents. If you have an abstraction layer between its not hard to change whats under.

But that makes an assumption you didnt make any shortcuts.

Re:Please put units in names by Closi on Monday March 21, 2022 @07:19PM (#30760982)
Considering I was actually consuming the data, if there was an abstraction layer then the field name was in that.