BigQuery executing only one query - google-bigquery

I'm trying to run a query in the UI, but I get the error:
Error: 6.1 - 0.0: Only one query can be executed at a time.
I don't think there is any other queries running, and this has lasted for a while now. Surely it can handle more than one query at a time?? How long will this be stuck? How can I turn bigquery off and on again :p

This error means that the query string has been parsed as containing multiple queries. Check that you do not have multiple top-level SELECT statements in the query text box.
From the specific message, I would guess your second query begins on or around line 6.

Related

Databricks SQL - How to get all the rows (more than 1000) in the first run?

Currently, in Databricks if we run the query, it always returns 1000 rows in the first run. If we need all the rows, we need to execute the query again.
In the situations where we know that we need to download full data(1000+ rows), is there a turn around way to execute the query to get all the rows in the first run without re-executing the query?
There should be a down arrow next to the download button which allows you to Download full results. Are you seeing that in your interface? (Source)

BQ PY Client Libraries :: client.run_async_query() vs client.run_sync_query()

I'm looking at BQ PY Client Libraries:
There used to be two different operations to query a table
client.run_async_query()
client.run_sync_query()
But in the latest version (v1.3) it seems there's only one operations to execute a query, Client.query(). Did I understand correctly?
And looking at GH code it looks Client.query() just returns the query job, not the actual query results / data.... Making me conclude it works in a similar way as client.run_async_query().. there's no replacement for client.run_sync_query() operation anymore which return query results (data) synchronously / immediately?
Thanks for the clarification!
Cheers!
Although .run_sync_query() has been removed, the Query reference says that short jobs may return results right away if they don't take long to finish:
query POST /projects/projectId/queries
Runs a BigQuery SQL query and returns results if the query completes within a specified timeout.

Getting /usr/local/google-cloud-sdk/bin/bq: Argument list too long error in BigQuery

I am trying to execute an sql query using standardsql in Bigquery which is 224116 characters long with the help of "bq query command line tool" and I am getting following error :
/usr/local/google-cloud-sdk/bin/bq: Argument list too long error in BigQuery
Is there any workaround to overcome this error?
There is no error in my query as I am able to execute a smaller query with the same command.
There is no error in my query as I am able to execute a smaller query with the same command
I think you are hitting quotas!
Check Quota Policy for Queries
Maximum query length: 256 KB
Approximate size based on compression ratios
Is there any workaround to overcome this error?
you can try to split your code into few views and than use those views in main query, so your query will get smaller
in BQ Standard SQL use WITH (named subqueries) to reuse subqueries

how to debug "sql subquery returns more than 1 row" error

We have a huge SQL script involving tens of tables, subqueries, hundreds of attributes. It works perfectly in the test database but returns sql subquery returns more than 1 row error when running in the production database. The script was working perfectly up until now. The problem is, all I get is a one-line error specified above with no clues whatsoever which exact subquery causes the error which makes it near to impossible to debug. The question is, how am I supposed to know which line of the SQL causes the error? Is there any way to "debug" it line by line like you would do it in a programming language?
I am using TOAD with Oracle 11g.
Add print or DBMS_OUTPUT.PUT_LINE commands to your script to print messages. And/or use exception handlers in the script. Possibly add some variables that count or label which statement you are at, and output that in the exception handler.
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/errors.htm
Once you have found the query that causes the problem, convert it to a similar query with an appropriate group by and having count(*) > 1 so that you can see what data caused the problem. For instance if you have a correlated subquery that looks like:
(select name from names where id=foo.id)
then write a similar query
select id from names group by id having count(*) > 1
to identify the offending data.
If you have multiple subqueries in the query that produces the error, you could temporarily convert the subqueries to use temporary tables and search them all for duplicates.

Error "Arithmetic operation resulted in an overflow."

I'm tasked to create a program that will run an extremely long query. That query executes well in Oracle but whenever I try to run it from VB.Net, it results to the error mentioned on the title. And also, I have noticed that when I copy my query to an SQLDataSource, it copied only certain parts and not the whole query. Is there any chance for this? Thank you!