Hacker News new | ask | show | jobs
by gwn7 1111 days ago
For dry runs on RDBMS' I usually put the statements I want to test between transaction begin and a rollback statements. Maybe dump some data before rolling back to make analyses and/or comparisons.

I guess this tool probably has more utility though.

2 comments

Hi, thanks for responding. This tool automates the tasks you stated in your comment. Instead of having to write specialty code every time you need to test your sqls you can click a button and have the tool set up it up for you. Also what happens if you need to test your SQL against multiple database(ie IUAT/Model Office/Production) and/or multiple schemas? This is just one click in my program.
I'm sure it can't match the flexibility & features your program offers, but a hacker's way would be providing that functionality via a one liner targeting their database. Assuming that dbs.txt contains a list of connection strings and migration.sql contains a set of SQL commands, an example for Postgres would be:

  cat dbs.txt | xargs -I% sh -c 'cat migration.sql | sed "1ibegin;" | sed "\$arollback;" | psql %'
Don't get me wrong, I'm not trying to shit on your product; just wanted to share the way I accomplish basically the same goal. Congrats on your release and hope it gets the attention it deserves.
Don't worry I have a thick skin. It's better for people to tell me what they don't like or if there is a better way to do something than to say they like the product when they really don't. The really nifty thing with my program is you can see what the data would look like. I can't tell if your script does that.
I do the same and transactions work well most of the time. I use ZFS as filesystem for my DBMS (Postgres), which allows me to do consistent snapshots. Being able to rollback has been helpful for testing complex or large queries as well.
How does this work when you need to test your script against multiple databases and multiple schemas? Is this for an enterprise size application?
I am interested in your use case where you have a situation with multiple databases, possible with different schemas, where you want to run the same sql on all of them. Maybe some kind of data lake? I have not come across this. But admittedly I have not worked in enterprise (I take to mean thousands of employees)
In enterprise environments this is pretty common. I've worked at places with over 100 developers and 30 testers. So you have a situation with hundreds if not thousands of databases and then multiple schemas in each database. So imagine trying to manually validate if your script will work on all those databases and against all those schemas. How difficult of a task that is.