Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid EXECUTE IMMEDIATE sql string error when fully qualified target table name is used in bqml_generate_text #475

Open
vitalii-filipov opened this issue Feb 18, 2025 · 0 comments

Comments

@vitalii-filipov
Copy link
Contributor

Hello Everyone,

When bqml_generate_text stored procedure is called with target_table parameter set to a fully qualified table name with a project that contains dashes -, this error is shown (added formatting for readability)

Invalid EXECUTE IMMEDIATE sql string `
    CREATE TEMP TABLE _SESSION.text_batch AS 
    (SELECT * 
           FROM (SELECT description_id, '''
            My prompt with descriptions:
           ''' || descriptions || '''
           Your answer as a JSON:
           ''' AS prompt FROM `project-with-dashes.some_dataset.source_table` WHERE TRUE) AS S 
          WHERE NOT EXISTS (SELECT * FROM project-with-dashes.some_dataset.target_table AS T WHERE S.description_id = T.description_id)
          LIMIT 1000
    )
 `, Syntax error: Missing whitespace between literal and alias at [bqutil.procedure_eu.bqml_generate_text:123:5] 

Code that produces the error:

CALL `bqutil.procedure.bqml_generate_text`(
    "project-with-dashes.some_dataset.source_table",   -- source table
    "project-with-dashes.some_dataset.target_table",  -- destination table
    "project-with-dashes.some_dataset.text_generation_model",        -- model
    """
    ''' My prompt with descriptions: ''' || descriptions || ''' Your answer as a JSON: '''
    """,                                     -- content column
    ["description_id"],              -- key columns
    '''{
        "temperature": 0
    }'''                                        -- optional arguments
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant