Sample Header Ad - 728x90

I get the error "(psycopg2.OperationalError) FATAL: role "wsb" does not exist", but the user does exits

0 votes
1 answer
2432 views
I am trying connect to my postgress database using SQLAlchemy. I was working fine yesterday (01/27/22). Now I get the following error: > sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: role "wsb" does not exist Only the user does exist.
=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 wsb       | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 wsb2      |                                                            | {}
As you can see I tried making another user "wsb2", but that didn't work either. Below is my script:
db_string = "postgresql://wsb:wsb@localhost:5432/wsb"

db = create_engine(db_string)
meta = MetaData()

submissions_table = Table('wsb_submissions', meta,
                          Column('index', INTEGER),
                          Column('submission_id', TEXT),
                          Column('title', TEXT),
                          Column('created', TIMESTAMP),
                          Column('author', TEXT),
                          Column('ticker_mentioned', TEXT),
                          Column('subreddit', TEXT),
                          Column('emotes', ARRAY(TEXT)),
                          Column('rocket_emotes', INTEGER)
                          )

comments_table = Table('wsb_comments', meta,
                       Column('index', INTEGER),
                       Column('comment_id', INTEGER),
                       Column('body', TEXT),
                       Column('created', TIMESTAMP),
                       Column('author', TEXT),
                       Column('rocket_emotes', INTEGER),
                       Column('subreddit', TEXT),
                       Column('emotes', ARRAY(TEXT)),
                       Column('submission_key', TEXT)
                       )
db.connect()
also here is my Dockerfile:
FROM postgres:13.2

ENV POSTGRES_PASSWORD=wsb
ENV POSTGRES_USER=wsb
ENV POSTGRES_DB=wsb

COPY wsb.sql /docker-entrypoint-initdb.d/
EXPOSE 5432
Asked by W. Hunter Giles (1 rep)
Jan 28, 2022, 04:50 PM
Last activity: Jan 30, 2022, 09:19 PM