Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

TrinoSource.get_table_query_string() omits parentheses around query, causing SQL syntax errors in Trino compute engine #7017

Open

Description

@Marcus-Rosti

Expected Behavior

When a TrinoSource is configured with query=..., calling get_table_query_string() should return the query wrapped in parentheses (f"({self.query})") so it can be referenced directly as a derived table in SQL FROM clauses.

This matches the behavior of all other SQL sources in Feast (BigQuerySource, SnowflakeSource, AthenaSource, RedshiftSource).

Current Behavior

TrinoSource.get_table_query_string() returns raw self.query:

def get_table_query_string(self) -> str:
    return self.table or self.query

Steps to reproduce

  1. Define a TrinoSource using query=...:
source = TrinoSource(
    name="user_source",
    query="SELECT user_id, event_timestamp, val FROM catalog.schema.table",
    timestamp_field="event_timestamp",
)
  1. Attach it to a feature view with online=True.
  2. Configure batch_engine: {"type": "trino.engine"} and call store.materialize(...).
  3. Trino fails during cursor.execute() with SYNTAX_ERROR: mismatched input 'SELECT'.

Activity

  1. Mrun25 commented on Oct 15, 2026

    @Mrun25

    Hi @ntkathole - I'd like to work on this one. I reproduced it against current master: TrinoSource(name='t', query='SELECT a, b FROM my_table WHERE x > 1').get_table_query_string() returns the raw query without parentheses, so downstream SQL becomes SELECT * FROM SELECT a, b FROM my_table WHERE x > 1 ..., which is invalid. The fix is to wrap the query in parentheses in get_table_query_string() plus a unit test. Could you assign it to me?

  2. Marcus-Rosti commented on Oct 16, 2026

    @Marcus-Rosti
    ContributorAuthor

    @Mrun25 I already fixed this in #7018

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