Skip to content

BigQuery: _upload_entity_df does not escape the table name #3327

@jallard-ueat

Description

@jallard-ueat

Expected Behavior

I expect get_historical_features to work even if the project name is not correctly detected by BigQuery without enclosing it in backtick.

Current Behavior

Some project names can cause the get_historical_features to fail because the create statement in _upload_entity_df
code

job = client.query(f"CREATE TABLE {table_name} AS ({entity_df})")

does not enclose the table_name in backtick

We currently have the issue with a GCP project name that is suffixed by -12c1

The relevant error on BigQuery is

Syntax error: Missing whitespace between literal and alias at [1:28]

Steps to reproduce

  1. Create a GCP project with a suffix that must be backticked in BigQuery (e.g dummy-project-12c1)
  2. Attempt to run a get_historical_features

Specifications

  • Version: 0.22
  • Platform: Linux
  • Subsystem: Ubuntu 20.04

Possible Solution

I think the best solution is to add the backticks around the table_name

job = client.query(f"CREATE TABLE `{table_name}` AS ({entity_df})")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions