Reputation: 357
I'm attempting to write a script to fetch certain data from an existing PostgreSQL database with SQLAlchemy. All operations will be read-only (i.e. only SELECT operations), if that matters.
My understanding is that in order to work with an existing database I need to reflect it.
self.engine = create_engine(f"postgresql+psycopg2://{self.conn_str}")
self.metadata = MetaData(bind=self.engine)
MetaData.reflect(self.metadata)
When I run this I get a bunch of warnings from MetaData.reflect()
:
SAWarning: Skipped unsupported reflection of expression-based index idx_users_email_lower
Should I define these indices somehow, or how do I deal with this? Will my querying be slow if the indices are unsupported?
Upvotes: 2
Views: 2811
Reputation: 123849
The warning is telling you that the results returned by a call to .get_indexes()
will not include the expression-based index. The index still exists in the database, and the PostgreSQL query parser will still be able to use it when generating an execution plan.
Performance would only be affected if the absence of that index in the SQLAlchemy MetaData would affect the SELECT statements that SQLAlchemy emits. That seems unlikely to me.
Upvotes: 3