From: | Ozan Kahramanogullari <ozan(dot)kah(at)gmail(dot)com> |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us |
Cc: | Andrej Ricnik <andrej(dot)groups(at)gmail(dot)com>, Jeff Frost <jeff(dot)frost(at)gmail(dot)com>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: psql on Mac |
Date: | 2018-10-24 09:54:24 |
Message-ID: | CAPiqqL=S8+ns8zGwjSfCR24hq8GEsd4Uj=XsNEw+rJ2Y=oY=OA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-novice |
Well, I took the default settings when I was installing PostgreSQL. And,
yes, I ran the "show" commands on the command line console; it gave an
error. I ran the "show" commands on the psql prompt that delivered nothing,
no error as well.
I am open to any suggestions, including reinstalling everything from
scratch, if there are any precise instructions.
I am not ruling out that I am doing something wrong. Though, I was
convinced that following simple instructions would not be that hard. I have
tried to provide all the information in the previous emails. I am puzzled
myself; after all, this is quite a standard platform (Mac) and all I am
trying to do is access some SQL database with a python file (see below).
Cheers,
Ozan
######## SQL stuff ###########
CREATE TABLE flights (
id SERIAL PRIMARY KEY,
origin VARCHAR NOT NULL,
destination VARCHAR NOT NULL,
duration INTEGER NOT NULL
);
INSERT INTO flights (origin, destination, duration) VALUES ('New York',
'London', 415);
INSERT INTO flights (origin, destination, duration) VALUES ('Shanghai',
'Paris', 760);
INSERT INTO flights (origin, destination, duration) VALUES ('Istanbul',
'Tokyo', 700);
INSERT INTO flights (origin, destination, duration) VALUES ('New York',
'Paris', 435);
INSERT INTO flights (origin, destination, duration) VALUES ('Moscow',
'Paris', 245);
INSERT INTO flights (origin, destination, duration) VALUES ('Lima', 'New
York', 455);
######## python file ##########
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
engine = create_engine(os.getenv("DATABASE_URL"))
db = scoped_session(sessionmaker(bind=engine))
def main():
flights = db.execute("SELECT origin, destination, duration FROM
flights").fetchall()
for flight in flights:
print(f"{flight.origin} to {flight.destination}, {flight.duration}
minutes.")
if __name__ == "__main__":
main()
##############################
On Wed, 24 Oct 2018 at 11:42, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Ozan Kahramanogullari <ozan(dot)kah(at)gmail(dot)com> writes:
> > Hi Tom, Thank you! I copied and pasted the content of your pg_hba file as
> > it is. Then, I rebooted my computer. There is only one installation of
> > postgreSQL, so there is only such file. It is in the folder
> > "/Library/PostgreSQL/10/data".
>
> I'm a bit suspicious of that, first because that doesn't seem like a
> normal place to put Postgres, and second because it's not working for
> you so there must be *something* incorrect in what you've told us.
> Did you confirm the server's notion of where pg_hba.conf is via
> "show" and/or the view?
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Gerald Cheves | 2018-10-24 10:10:15 | Re: psql on Mac |
Previous Message | Tom Lane | 2018-10-24 09:42:23 | Re: psql on Mac |
From | Date | Subject | |
---|---|---|---|
Next Message | Gerald Cheves | 2018-10-24 10:10:15 | Re: psql on Mac |
Previous Message | Tom Lane | 2018-10-24 09:42:23 | Re: psql on Mac |