If I merge `subscription` object into a session, `subscription.customer` is 
not accessible while `subscription.customer_id` is set:

ipdb> subscription.__dict__
{'domain': u'ru', 'utm_content': None, 'updated_at': 
datetime.datetime(2013, 11, 6, 16, 45, 2, 85355), 'confirm_code': 
'39fa80de46e111e3a87c7cc3a1893675', 'id': 10000, 'utm_campaign': None, 
'utm_keyword': None, 'utm_medium': None, 'location': None, 'customer_id': 
100000001L, 'email': 'test100000...@moda.ru', 'status': 'UNCONFIRMED', 
'_sa_instance_state': <sqlalchemy.orm.state.InstanceState object at 
0x3497dd0>, 'utm_term': None, 'utm_source': None, 'sms_status': 
'UNSUBSCRIBED', 'referer': None, 'auto_gender': None, 
'_validation_errors_set': set([]), 'name': None, 'status_changed_at': None, 
'gender': u'M', 'region': None, 'year_of_birth': None, 'url': None, 'city': 
None, 'created_at': datetime.datetime(2013, 11, 6, 16, 45, 2, 85355)}
ipdb> subscription = session.merge(subscription)
16:45:21    INFO [sqlalchemy.colorsql]:  0.002s  SELECT subscription.id AS 
subscription_id, subscription.customer_id AS subscription_customer_id, 
subscription.email AS subscription_email, subscription.status AS 
subscription_status, subscription.sms_status AS subscription_sms_status, 
subscription.status_changed_at AS subscription_status_changed_at, 
subscription.confirm_code AS subscription_confirm_code, subscription.gender 
AS subscription_gender, subscription.auto_gender AS 
subscription_auto_gender, subscription.location AS subscription_location, 
subscription.utm_source AS subscription_utm_source, subscription.utm_medium 
AS subscription_utm_medium, subscription.utm_campaign AS 
subscription_utm_campaign, subscription.utm_content AS 
subscription_utm_content, subscription.utm_term AS subscription_utm_term, 
subscription.utm_keyword AS subscription_utm_keyword, subscription.url AS 
subscription_url, subscription.referer AS subscription_referer, 
subscription.domain AS subscription_domain, subscription.name AS 
subscription_name, subscription.year_of_birth AS 
subscription_year_of_birth, subscription.region AS subscription_region, 
subscription.city AS subscription_city, subscription.created_at AS 
subscription_created_at, subscription.updated_at AS 
subscription_updated_at, customer_1.id AS customer_1_id, 
customer_1.first_name AS customer_1_first_name, customer_1.last_name AS 
customer_1_last_name, customer_1.middle_name AS customer_1_middle_name, 
customer_1.email AS customer_1_email, customer_1.password AS 
customer_1_password, customer_1.date_of_birth AS customer_1_date_of_birth, 
customer_1.gender AS customer_1_gender, customer_1.phone AS 
customer_1_phone, customer_1.created_at AS customer_1_created_at, 
customer_1.updated_at AS customer_1_updated_at, customer_1.is_active AS 
customer_1_is_active, customer_1.is_deleted AS customer_1_is_deleted, 
customer_1.last_login AS customer_1_last_login, customer_1.mnogoru AS 
customer_1_mnogoru, customer_1.sclub AS customer_1_sclub
FROM subscription
LEFT OUTER JOIN customer AS customer_1 ON customer_1.id = 
subscription.customer_id
WHERE subscription.id = 10000
ipdb> subscription.customer_id
100000001L
ipdb> subscription.customer
ipdb> 

-- 
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/groups/opt_out.

Reply via email to