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

Missing alias in PostgreSQLOfflineStore.pull_all_from_table_or_query() #2954

Closed
ikrizanic opened this issue Jul 20, 2022 · 0 comments · Fixed by #2956
Closed

Missing alias in PostgreSQLOfflineStore.pull_all_from_table_or_query() #2954

ikrizanic opened this issue Jul 20, 2022 · 0 comments · Fixed by #2956

Comments

@ikrizanic
Copy link
Contributor

Expected Behavior

Call pull_all_from_table_or_query() method and retrieve wanted data from offline store.

Current Behavior

SQL error psycopg2.errors.SyntaxError: subquery in FROM must have an alias

Steps to reproduce

Call pull_all_from_table_or_query() on PostgreSQLOfflineStore, where PostgreSQLSource is initialized with query="SELECT * FROM table_name"

Specifications

  • Version: 0.22.1
  • Platform: x86_64
  • Subsystem: Linux 5.18

Possible Solution

Adding alias in query located in PostgreSQLOfflineStore.pull_all_from_table_or_query(), for example adding AS dummy_alias. This was tested on my use-case and it works as expected, and if it looks ok, I could open a PR with this change.

query = f"""
            SELECT {field_string}
            FROM {from_expression} AS dummy_alias
            WHERE "{timestamp_field}" BETWEEN '{start_date}'::timestamptz AND '{end_date}'::timestamptz
        """
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant