Hope this helps.

>>> _r = SessionIP.objects.get(id=1000)

# figured this out by doing dir(_r._meta)
>>> _r._meta.db_table
'ddcms_sessionip'

# figured this out by looking at
https://docs.djangoproject.com/en/dev/topics/db/multi-db/
>>> _r._state.db
'nats_rw'

Cal

2011/9/27 Juan Pablo Romero Méndez <[email protected]>

> Hello,
>
> Suppose I get an object from a non-default database:
>
> ob = MyModel.objects.using('somedb').get(pk=1)
>
> Is it possible later to retrieve the database name just from the object?
>
> ob.db??
>
> Regards,
>
>  Juan Pablo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to