Reflecting a postgreSQL database with extensions?

141 views
Skip to first unread message

Carl Brewer

unread,
Aug 15, 2022, 11:30:53 PM8/15/22
to sqlalchemy

G'day,
I'm trying to reflect a PostgreSQL database into the ORM that has an
extension in it.

Code snippet :


arinc_engine =
create_engine("postgresql://"+pgReadOnlyUser.name+":"+pgReadOnlyUser.passwd+"@"+PostgresServer+"/"+ARINCDB)
print(arinc_engine)

arinc_Base = declarative_base()
arinc_metadata = MetaData(arinc_engine)
arinc_metadata.reflect()




I see these warnings :

Engine(postgresql://****:***@***.someserver.site/arinc)
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'navaid'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'dme'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'geometry' of column 'geom'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type 'spoly'
of column 'chartbounds'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'toppos'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'bottompos'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'arp'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'old_arp'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'new_arp'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'point'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'centre'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type 'spoly'
of column 'bounds'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type 'spoly'
of column 'region'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'location'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type 'sline'
of column 'route'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'spoint' of column 'waypoint'
arinc_metadata.reflect()
/apps/lib/./avsoft_data.py:53: SAWarning: Did not recognize type
'geometry' of column 'wkb_geometry'
arinc_metadata.reflect()



The extension is pgSphere - it does some nifty stuff with spherical
co-ordinates. Doesn't really matter for this task.

If I don't care about what the data is that's been stored using this
extension, can I safely just ignore these warnings? Or, is it possible
to load the extension into SQLAlchemy somehow?

I think I should be changing the base definition to
arinc_Base = automap_base() instead of the declarative base above, but I
don't think that makes any difference here?

Thank you

Carl

Mike Bayer

unread,
Aug 16, 2022, 9:17:21 AM8/16/22
to noreply-spamdigest via sqlalchemy
they are safe to ignore.  they might work if you install https://geoalchemy-2.readthedocs.io/en/latest/ if they include reflection support.

you can also implement an event hook where you can provide for your own logic to supply a type object (but you'd need to have stub classes for those types, geoalchemy again might be the best source for that)  , event hook: https://docs.sqlalchemy.org/en/14/core/events.html?highlight=column_reflect#sqlalchemy.events.DDLEvents.column_reflect  (I just noticed an error in the docs - the specific-metadata association feature is working)
-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper


To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.


Carl Brewer

unread,
Aug 17, 2022, 3:50:58 AM8/17/22
to sqlal...@googlegroups.com
On 16/08/2022 11:16 pm, Mike Bayer wrote:
> they are safe to ignore.


Thank you Mike. I'll ignore them for now. I don't need to deal with them
in this bit of software, just know that they exist.

Carl



Reply all
Reply to author
Forward
0 new messages