You'll need to post actual code and error stack traces if you want people
to help.
On Wednesday, 17 May 2017 15:08:55 UTC+2, Joe wrote:
>
> I am in the process of setting up a django server. I am trying to connect
> our 4 legacy DBs to her. I have created a separate app for each DB, added
> the
I am in the process of setting up a django server. I am trying to connect
our 4 legacy DBs to her. I have created a separate app for each DB, added
the app_label to the meta of the model and wrote a read only router for
each db. This was working fine until i got to the last one. The routing is
Hi Philip,
I'm not sure your sharding will be possible in the way you describe it.
There will be cases for which selecting the database will not be possible. For
example, Customer.objects.get(name=) won't be able which DB you'll need to
hit to get the result.
Same goes for a new Customer. H
Hello list,
In my database, I have a `Customer` table defined in my database that all
other tables are foreign keyed on.
class Customer(models.Model):
...
class TableA(models.Model):
Customer = models.ForeignKey(Customer)
...
class TableB(models.Model):
What I did is create an attribute in my models and called it
model.py
class Data(models.Model):
# connection_name is my database name which points to the name from
settings.py
connection_name = "gis"
name = models.CharField(max_length=50)
area = models.IntegerField()
and created a
The only solution I can directly think of, since the SITE_ID is in
settings.py would be to use some python logic to determine the
database for that site.
eg.
if SITE_ID == 1:
... Database settings for site 1 here ...
Use an if-then like this in your settings.py.
Now if what your going after
I had a kind of crazy idea and I wanted to bounce it off of some
people with a lot more django experience than I.
Here's my scenario...
I would like 1 code base, this code base services potentially hundreds
of businesses, each of which I want to have a copy of the same schema
but with data only r
Russ,
Your gut feeling confirms my suspicion.
Changing the lines to the following fixes my problem:
db = model_instance._state.db
if db is None:
db = router.db_for_write(model_instance.__class__,
instance=model_instance)
qs =
self.rel.to._default_manager.using(
On Tue, Jun 15, 2010 at 9:11 PM, johan de taeye
wrote:
>
>> You can't do this with a router; as you've noted, the router doesn't
>> have any information about the request in which it is being used.
>>
>> However, you could do it by manually requesting your database
>> connection whenever you use t
> You can't do this with a router; as you've noted, the router doesn't
> have any information about the request in which it is being used.
>
> However, you could do it by manually requesting your database
> connection whenever you use the database. For example:
>
> Author.objects.using('otherdb').
On Tue, Jun 15, 2010 at 7:12 PM, johan de taeye
wrote:
> Hello,
>
> In my application a number of databases are configured with identical
> schemas.
> From a dropdown box on the screen, the user selects the database he/
> she wants to work with. The selected database is stored on the
> cookie.
>
I didn't work with multidb but I think it is possible anyway... try it using
additional middleware... for example.. change dynamically db settings...
etc
On Tue, Jun 15, 2010 at 2:12 PM, johan de taeye wrote:
> Hello,
>
> In my application a number of databases are configured with identical
> sch
Hello,
In my application a number of databases are configured with identical
schemas.
>From a dropdown box on the screen, the user selects the database he/
she wants to work with. The selected database is stored on the
cookie.
An object with the same primary key can be created in each schema by
t
13 matches
Mail list logo