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

altered syntax to work with postgres #365

Closed
wants to merge 2 commits into from

Conversation

trbouma
Copy link
Contributor

@trbouma trbouma commented Nov 16, 2023

I got the following error when attempting to connect to postgres. The error has to do with a syntax variation of where AS should be placed. I fixed by moving the AS clause. It now works with postgres and I tested with SQLite

2023-11-16 14:26:06.96 | ERROR | psycopg2.errors.SyntaxError: subquery in FROM must have an alias
LINE 3:             SELECT COALESCE(SUM(s), 0) AS balance FROM (
                                                               ^
HINT:  For example, FROM (SELECT ...) [AS] foo.


The above exception was the direct cause of the following exception:

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.SyntaxError) subquery in FROM must have an alias
LINE 3:             SELECT COALESCE(SUM(s), 0) AS balance FROM (
                                                               ^
HINT:  For example, FROM (SELECT ...) [AS] foo.

[SQL: 
            CREATE VIEW balance_issued AS
            SELECT COALESCE(SUM(s), 0) AS balance FROM (
                SELECT SUM(amount) AS s
                FROM promises
                WHERE amount > 0
            );
        ]
(Background on this error at: http://sqlalche.me/e/13/f405)

2023-11-16 14:26:06.96 | ERROR | Application startup failed. Exiting.

Copy link

codecov bot commented Nov 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fa5193c) 66.31% compared to head (f091faf) 66.00%.

❗ Current head f091faf differs from pull request most recent head ff1824d. Consider uploading reports for the commit ff1824d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #365      +/-   ##
==========================================
- Coverage   66.31%   66.00%   -0.31%     
==========================================
  Files          68       68              
  Lines        5219     5160      -59     
==========================================
- Hits         3461     3406      -55     
+ Misses       1758     1754       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@callebtc callebtc closed this Feb 2, 2024
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

Successfully merging this pull request may close these issues.

2 participants