5 Replies Latest reply on Jul 10, 2014 9:35 AM by Dan Cory

    Custom SQL / BigQuery unable to compile the query

    Marc Toussain

      (Tableau 8.2)

       

      Hello guys,

       

      I'm trying use a custom SQL to query my databases on Google BigQuery, but unfortunately I get an error message that I don't understand:

       

      The Google BigQuery service was unable to compile the query.

      Encountered "" at line 1, column 355.

      Was expecting one of:

         

      Unable to connect to the server "googleapis.com/bigquery". Check that the server is running and that you have access privileges to the requested database.

      The Google BigQuery service was unable to compile the query.

       

      This is really strange because the same code works flawlessly when I use it on the Google BigQuery website.

       

      SELECT

          user_id,

          profile_email       AS email,

          profile_first_name  AS first_name,

          profile_last_name   AS last_name,

          CASE WHEN MAX(coupons_count) = 0

              THEN 'click'

              ELSE 'coupon'

          END                 AS involvement,

          MAX(coupons_count)  AS coupons

      FROM

       

        ( -- hits

          SELECT

              user_id,

              profile_email,

              profile_first_name,

              profile_last_name,

              INTEGER(0) AS coupons_count    

          FROM [shopmium.all_hits]       

          WHERE hit_rank_for_viewer = 1

          AND offer_id = <Parameters.offer_id1>

          OR offer_id = <Parameters.offer_id2>

          OR offer_id = <Parameters.offer_id3>

          OR offer_id = <Parameters.offer_id4>

          OR offer_id = <Parameters.offer_id5>

         ),

        

        ( -- coupons

          SELECT

              user_id,

              profile_email,

              profile_first_name,

              profile_last_name,

              INTEGER(COUNT(*)) AS coupons_count    

          FROM [shopmium.accepted_coupons]

          WHERE offer_id = <Parameters.offer_id1>

          OR offer_id = <Parameters.offer_id2>

          OR offer_id = <Parameters.offer_id3>

          OR offer_id = <Parameters.offer_id4>

          OR offer_id = <Parameters.offer_id5>

          GROUP EACH BY 1,2,3,4

        )

       

       

      GROUP EACH BY 1,2,3,4

       

      Can you help me ?

       

      Thank you.