Skip to content

BigQuery: _upload_entity_df does not escape the table name #3327

Closed

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})")

Activity

  1. stale commented on Mar 18, 2023

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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