0

I am struggling to use BigQuery's ML features. Basically, I write the following query and the it fails with this message:

Syntax error: Unexpected string literal 'finance-ml-jdb.FOREX.EURGBP' at [17:3]

   CREATE MODEL `finance-ml-jdb:FOREX.EURGBP_Model`
   OPTIONS( model_type         = 'linear_reg',
            input_label_cols   = bidlow,
            ls_init_learn_rate = .15,
            l1_reg             = 1,
            max_iterations     = 5
           ) AS
   SELECT
     bidopen,
     bidhigh,
     bidlow,
     askopen,
     askclose,
     asklow,
     tickqty
   FROM
      'finance-ml-jdb.FOREX.EURGBP'
   Order By
      CAST(date AS DATETIME) DESC

I suspect I've got something wrong with the use of '' or `` when specifying finance-ml-jdb.FOREX.EURGBP but I'm not sure exactly what I need to do to fix it.

Any help would be much appreciated,

Thanks,

Josh

Pyy
  • 327
  • 6
  • 23
  • Possible duplicate of [Syntax error: Unexpected string literal '93868086.ga\_sessions\_' at \[1:244\] - BigQuery](https://stackoverflow.com/questions/51143932/syntax-error-unexpected-string-literal-93868086-ga-sessions-at-1244-big) – Temu Sep 04 '18 at 08:09

2 Answers2

3

After you will fix

FROM 'finance-ml-jdb.FOREX.EURGBP'   

to

FROM `finance-ml-jdb.FOREX.EURGBP`   

your next issue will be below line

        input_label_cols   = bidlow,

It should be fixed to

        input_label_cols   = ['bidlow'],   

And finally, you should remove below line,as it is not useful for CREATE MODEL and only can result with Resource Exceeded ... if you have relatively large data for training

   Order By CAST(date AS DATETIME) DESC
Mikhail Berlyant
  • 165,386
  • 8
  • 154
  • 230
  • Thats really useful and clears up several errors. However, after running the new corrected query. I get the following error An internal error occurred and the request could not be completed. – Pyy Sep 03 '18 at 10:28
  • Then this solved your question but now you have a different problem. May you create a new question specifying the details or providing an example of your actual query? – Temu Sep 04 '18 at 08:05
1

You need to use back-ticks, not single quotes.

`finance-ml-jdb.FOREX.EURGBP`
Graham Polley
  • 14,393
  • 4
  • 44
  • 80