I have been struggling with an odbc connection and seemingly limited to being able to pass .sql query files that are on a single line.
e.g. If I pass a .sql file with the following content, things work great:
select * from `ourproject.ua.sometable` limit 10;
However, if the file looks like this:
SELECT *
FROM `ourproject.ua.sometable`
LIMIT 10;
I get errors.
My command looks like this, where the queries above are in the file query.sql:
isql -v -b BigQuery < query.sql > data.txt
I wondered if there's a bash command work around solution where I could tell bash to read query.sql as a single line, or 'reduce' the file to a single line, before passing to isql
.
Is this possible?
[edit] I tried some solutions from over here but these seem to interpret the contents of the file as a command, whereas I need an intermediate step of getting them into one line before passing them to a command e.g.
echo `cat query.sql`
SELECT SimbaODBCDriverforGoogleBigQuery_2.4.6.1015-Linux.tar.gz bin bla.txt boot data.txt dev etc home lib lib64 media mnt opt proc query.sql root run sbin service.json srv sys tmp usr var FROM `ga4-extract.analytics_302644320.events_20220608` LIMIT 10;
Expected/wanted just a single line:
select * FROM `ga4-extract.analytics_302644320.events_20220608` LIMIT 10;