Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
get_db() being called in QuerySetManager
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
sunil arora  
View profile  
 More options Feb 13 2012, 1:26 am
From: sunil arora <arora.su...@gmail.com>
Date: Mon, 13 Feb 2012 11:56:21 +0530
Local: Mon, Feb 13 2012 1:26 am
Subject: get_db() being called in QuerySetManager

Hi,

We need a quick help to resolve a critical issue.

We are using 0.4 version of mongoengine. We will be updating to latest
version, but that is a couple of weeks away.

We are facing a weird situation about DB connectivity.

Very recently we started using inheritance in our models. For ex.

Class A(Document): pass

Class B(A): pass

Class C(A): pass

With introduction of such classes, we are seeing _get_db() function is
being invoked on import of our B, C classes.

I traced further and found that in TopLevelDocumentMetaClass's new method,
where QuerySetManager is being instantiated and in turn descriptor __get__
is being called which is making _get_db() call.

Reason we have a problem with _get_db() being invoked during importing of
our modules, it creates a db connection with with default settings which
are "localhost:27017", which we want to avoid because we are reusing the
same connection.

We want connection to be made on explicit call instead during the imports.

I did some digging in 0.5 code and it has changed significantly in those
areas where QuerySetManger is being defined.

Thanks
Sunil


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ross Lawley  
View profile  
 More options Feb 13 2012, 4:35 am
From: Ross Lawley <ross.law...@gmail.com>
Date: Mon, 13 Feb 2012 09:35:35 +0000
Local: Mon, Feb 13 2012 4:35 am
Subject: Re: get_db() being called in QuerySetManager

Hi Sunil,

Unfortunately, that is the case with 0.4 in 0.5 we refactored how document
/ collections were initially setup and how we deal with creating capped
collections etc.

Creating the connection before importing document models will stop
mongoengine using its default connection settings.

Ross


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sunil arora  
View profile  
 More options Feb 13 2012, 6:02 am
From: sunil arora <arora.su...@gmail.com>
Date: Mon, 13 Feb 2012 16:32:07 +0530
Local: Mon, Feb 13 2012 6:02 am
Subject: Re: get_db() being called in QuerySetManager

Hi Ross,

Thanks for the quick reply.

If we have to upgrade from 0.4 to 0.5, what are key points that we should
keep in mind.  Any breaking changes that we need to be aware about ?

Thanks
Sunil

On 13 February 2012 15:05, Ross Lawley <ross.law...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ross Lawley  
View profile  
 More options Feb 13 2012, 6:21 am
From: Ross Lawley <ross.law...@gmail.com>
Date: Mon, 13 Feb 2012 11:21:36 +0000
Local: Mon, Feb 13 2012 6:21 am
Subject: Re: get_db() being called in QuerySetManager

Hi Sunil,

There are a number of relatively minor upgrade steps -
http://mongoengine.org/docs/v0.5/upgrade.html?highlight=upgrade#to-0-5

As always, test first!

Ross


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sunil arora  
View profile  
 More options Feb 13 2012, 6:46 am
From: sunil arora <arora.su...@gmail.com>
Date: Mon, 13 Feb 2012 17:16:50 +0530
Local: Mon, Feb 13 2012 6:46 am
Subject: Re: get_db() being called in QuerySetManager

Thanks for the pointer Ross!

On 13 February 2012 16:51, Ross Lawley <ross.law...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »