First thing is to get a Postgres client (Postico is great on Macs) and make sure you can connect to the Postgres DB through that. You'll get better error messages and from there you can pull that into the Rails app.
Otherwise /u/r_levan is on the right track, the defaults of the Postgres docker image and the defaults of Rails don't line up. Try what he mentioned and get back to us.
When I'm using psycopg2, I write my SQL outside of my python shell (usually in Postico https://eggerapps.at/postico/) and import the file to run the query.
E.g.
with open('./path_to_config/config.json') as f:
config = json.load(f)
config_string = "host=%s dbname=%s user=%s password=%s" % (config.get('host'), config.get('database'), config.get('user'), config.get('passw'))
sql_connection = psycopg2.connect(config_string) # Connect to your db
query = open('/path/to/file.sql', 'r') # This will make your life easier
query_result_dataframe = pd.read_sql(query.read(), con=sql_connection) # Run the query
This is a great tutorial. I would also recommend installing a Postgres GUI (my go-to is Postico) so you can explore the data in a more friendly way rather than just running the pre-written commands in the command line. Do various selects and joins, and play around with the data to feel comfortable with SQL.
hes right 100%. if you are literally a blind autistic developer it's great. But please try to show me the hundreds of very nicely designed workflow apps that makes programming/designing easier. Heres a simple one, show me a very usable PG GUI app that beats https://eggerapps.at/postico/
Show me a Redis GUI... show me nice FTP app that beats Transmit (FTP not used anymore, but still it has some uses for servers that require FTP logs etc)
Show me a super easy markup tool to convey ideas to support people better than Skitch
Yeah, you wont find any because linux apps look like an aborted fetus and are absolutely atrocious as far as UI. You can tell very smart programmers who are 100% devoid of any creative sense at all designed them. Lets add 900,000 options you dont need to make doing even the simplest tasks inefficient
The beauty of mac is that most ridiculously nuanced pointless features are abstracted away, because a very small % of users are 20 year DBA's. IF you need that functionality, say a much more detailed Postgres app, they are there.
If SQL Server isn't a requirement and you can use anything, I recommend Postgres.app. It's a simple Postgres server that you launch like a regular app and lives in the menu bar. The maintainer for the app also has a client for OS X, or you could use pgAdmin.
Been using postico lately. I'd love the object lookup stuff from sql tabs to be in postico. I'd love the results view to be in sql tabs. Having the ability to resize columns is pretty nice when dealing with JSON. Also, select-all results copy/paste can be very helpful too.