I'm running a PostgreSQL database on a server and I'm trying to connect to it using SQLAlchemy. I found that sqlacodegen was a good tool to generate the MetaData object automatically along with its Tables. But when I try and run sqlacodgen postgresql+psycopg2://username:password@host:5432/dbname, I only get this:
# coding: utf-8
from sqlalchemy import MetaData
metadata = MetaData()
The connection string is definitely correct, and the database is up - I ran a small Python script using that connection string to connect to the database and used execute to run a query on it, and it returns exactly what I expected.
I'm not sure where even to start with debugging this. What could I do to see what's wrong? Is there some sort of requirement that sqlacodegen has that I'm missing?
As it turns out this problem was unrelated to
sqlacodegen. All the tables in my database are prefixed withdbname. Passing in--schema dbnameworks.