How can I use SQL WITH via DataGrip(AWS Athena)

I tried to run a query like

WITH foo as (
select
id
, name
from bar
)
select
id
, count(1)
from foo
group by 1

to AWS Athena.

But I got a following error message.

[HY000][100071] [Simba][AthenaJDBC](100071) An error has been thrown from the AWS Athena client. line 77:2: no viable alternative at input '<EOF>' [Execution ID not available] com.simba.athena.amazonaws.services.athena.model.InvalidRequestException: line 77:2: no viable alternative at input '<EOF>' (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID:xxxxxxxxxxxxxxxxxxxxxxxxxxxx; Proxy: null)

 

 But in case of following query succeed.

select
id
, count(1)
from (
select
id
, name
from bar
)
group by 1

DataGrip dose not support SQL WITH ?

My DataGrip is

DataGrip 2020.3.2
Build #DB-203.7148.68, built on January 26, 2021
Licensed to XXXXXXXXXXXXXX
Subscription is active until March 10, 2021.
Runtime version: 11.0.9.1+11-b1145.77 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.16
GC: ParNew, ConcurrentMarkSweep
Memory: 725M
Cores: 8

Cheers,

1 comment
Comment actions Permalink

Let's try this - go to Datagrip | Preferences | Database | General -> 'for selection execute' set to 'exactly as one statement', then select entire query and run it.

0

Please sign in to leave a comment.