Every class needs this boring code in configwrapper:
psycopg2.extras.register_composite(
'borderlinx_assets',
pgconn,
factory=BorderlinxAssetFactory)
And the factories so far have all been really simple:
class BorderlinxAssetFactory(psycopg2.extras.CompositeCaster):
def make(self, values):
d = dict(zip(self.attnames, values))
return BorderlinxAsset(**d)
It seems like I should be able to dynamically generate the Factory class. And then also I should be able to dynamically iterate through all the classes that are dynamically generated and register them for a table.
For example, imagine something like this in my BorderlinxAsset class:
class BorderlinxAsset(RelationWrapper):
sql_table_name = "borderlinx_assets"
and then everything else should be easy to figure out.
Every class needs this boring code in configwrapper:
And the factories so far have all been really simple:
class BorderlinxAssetFactory(psycopg2.extras.CompositeCaster):
It seems like I should be able to dynamically generate the Factory class. And then also I should be able to dynamically iterate through all the classes that are dynamically generated and register them for a table.
For example, imagine something like this in my BorderlinxAsset class:
and then everything else should be easy to figure out.