In the Shapefile class, instead of connecting to postgres as soon as the database is created, wait until get_layer is called.