Johnathan,

I was able to get my code working with your help. I was able to create an 
automapper of sorts between the two similar tables on the databases. I'm 
one step closer to finishing getting this done. 

I have one more question. How would I trigger this even to take place. For 
example I've accepted some form information and need to save to my local 
database. Then I need to trigger this "auto convert and map" function and 
save to the remote database with the previously saved data.

On Friday, January 30, 2015 at 1:42:34 PM UTC-6, Jonathan Vanasco wrote:
>
>
> You could use sqlacodegen (https://pypi.python.org/pypi/sqlacodegen) to 
> generate your model:
>
> • generate both models
> • generate one model, then regex the other
>
> if you make a lookup table/function to map one column name to another, you 
> could also loop over the columns.  something sort of like this:
>
>     for source_row in query(SourceObject).all()
>         kwargs = {}
>         for col in sqlalchemy_orm.class_mapper(source_row
> .__class__).mapped_table.c:
> destination_col = lookup_destination_column[col.name]
> kwargs[destination_col] = getattr(source_row, col.name)
> dbsession.add(DestinationObject(**kwargs))
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to