class Rio1(models.Model):
datestr = models.DateTimeField()
source = models.TextField()
dFlag = models.TextField()
url = models.TextField()
class Meta:
managed = False
db_table = 'rio1'class Rio2(models.Model):
datestr = models.DateTimeField()
source = models.TextField()
dFlag = models.TextField()
url = models.TextField()
class Meta:
managed = False
db_table = 'rio2'
On Tuesday 07 March 2017 10:50:24 aysh...@gmail.com wrote:
> Greetings,
>
> I am trying to do a join on the following 2 models (tables)
Models cannot be joined. There is no Model.join(). Models are objects you can relate to eachother.
Once you stop thinking in database terms, the problem is easily solved.
Since the two models are identical, why would you use two models? Your problem starts with your design - rethink it.
--
Melvyn Sopacua
On Wednesday 08 March 2017 06:23:44 aysh...@gmail.com wrote:
> Thanks for your answer, the models represent two different tables,
> identical structure but have to be segregated, there is no better
> design options to implement them. Any leads on how to do the join?
Think about what the join needs to do. Find duplicates? Get all of them in either table?
Provide the right question and Django will do the right join.
--
Melvyn Sopacua
Why are there no better design options to implement them? Are the tables being used in another software that you have no control over?
I would just merge the two tables and use one model.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
django-users...@googlegroups.com.
To post to this group, send email to
django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/5f7348a8-2267-4b18-96ee-624b22f63a5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why are there no better design options to implement them? Are the tables being used in another software that you have no control over?
I would just merge the two tables and use one model.
From: django...@googlegroups.com [mailto:django...@googlegroups.com] On Behalf Of aysh...@gmail.com
Sent: Wednesday, March 8, 2017 8:24 AM
To: Django users
Subject: Re: Simple Join with no matching primary keys
Thanks for your answer, the models represent two different tables, identical structure but have to be segregated, there is no better design options to implement them. Any leads on how to do the join?
Models cannot be joined. There is no Model.join(). Models are objects you can relate to eachother.
Once you stop thinking in database terms, the problem is easily solved.
Since the two models are identical, why would you use two models? Your problem starts with your design - rethink it.
--
Melvyn Sopacua
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to djang...@googlegroups.com.
Tables are coming from different sources, for each single datetime value there is a different url, in order to tie up the single source data it must live inside its own table.