[sqlalchemy] Handling of differences between a table and its mapped class

2015-01-23 Thread SF Markus Elfring
Hello,

What will (or should) happen if the column attributes
which are specified by a class that is derived
from declarative_base() differ (e. g. an other default
value) from the settings of an existing database table?

Is it occasionally appropriate to use different column
properties by the mapped Python classes?

Regards,
Markus

-- 
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.


Re: [sqlalchemy] Handling of differences between a table and its mapped class

2015-01-23 Thread Simon King
On Fri, Jan 23, 2015 at 9:11 AM, SF Markus Elfring
elfr...@users.sourceforge.net wrote:
 Hello,

 What will (or should) happen if the column attributes
 which are specified by a class that is derived
 from declarative_base() differ (e. g. an other default
 value) from the settings of an existing database table?

I assume you are talking about the server_default property (since
the default property is not part of the database table definition).
server_default is only passed to the database at CREATE TABLE time,
so if you don't use SQLAlchemy to create the tables (or you ALTER the
tables in the database after they've been created), the new default
will be used, but SQLAlchemy won't care.


 Is it occasionally appropriate to use different column
 properties by the mapped Python classes?


Maybe? *shrug*

Simon

-- 
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.