4 ms·
I find it really difficult to write parameterized SQL. The problems are many fold: I want to write a sql query I can deploy against test and prod, so I need to
by wodenokoto 3y ago
I find it really difficult to write parameterized SQL. The problems are many fold:
I want to write a sql query I can deploy against test and prod, so I need to be able to parameterize table names to some extend. Then there are values, as shown here, with all the footguns that entails. But in the end I also want to be able to have IDE niceties while developing. Autocomplete on column names and table names and inline be able to see types and those kind if things.
And I have never seen anything that can give you all those things.
- _a_a_a_ 3y agoIf you are allowed to create new schema objects then you can create views over the tables. Give the views a consistent name, but create the view to reference the actual table you want. Then update the view.
- sparks1970 3y agoI came across this yesterday for golang: https://sqlc.dev https://sqlc.dev which is somewhat like what you want, maybe. Not sure it allows you to parameterize table names but the basic idea is codegen from sql queries so you are working with go code (autocompletion etc).
- Shish2k 3y ago> I want to write a sql query I can deploy against test and prod, so I need to be able to parameterize table names … are your “test" and “prod" different tables in the same database? :S
- wodenokoto 3y agoFair point. But if I remember correctly, when I'm executing bigquery against parquet files in a bucket, they are kinda all in the big database of global bucket names on GCP.