Hi ,
Did you try python psycopg2.
A simple deomostration.
Ex:-
import psycopg2
conn=psycopg2.connect("dbname='xxx' user='xxx' host='localhost'
password='xxx'")
cur = conn.cursor()
query="""SELECT * FROM bookmarkmanager_bookmark b '
'LEFT JOIN bookmarkmanager_bookmark_tags bt
did you use Bookmark.objetcs.all().select_related() ?
As this will create a join query... at least for your model you show in the
message I have found that for very complex joins, you need to use raw
query and not a Model.
On Thursday, April 25, 2013 10:44:28 AM UTC-4, Matthieu Bouron wrote
On Thursday, April 11, 2013 5:39:57 PM UTC+2, Tom Evans wrote:
>
> On Thu, Apr 11, 2013 at 3:42 PM, Matthieu Bouron
> > wrote:
> > Hello,
> >
> > Is there a way to handle many-to-many relationship with raw sql queries
> ?
> > I have the following model:
> >
> > from django.db import models
On Thu, Apr 11, 2013 at 3:42 PM, Matthieu Bouron
wrote:
> Hello,
>
> Is there a way to handle many-to-many relationship with raw sql queries ?
> I have the following model:
>
> from django.db import models
>
> class Tag(models.Model):
> name = models.CharField(max_length=512, unique=True)
>
>
Hello,
Is there a way to handle many-to-many relationship with raw sql queries ?
I have the following model:
from django.db import models
class Tag(models.Model):
name = models.CharField(max_length=512, unique=True)
class Bookmark(models.Model):
link = models.CharField(max_length=512)
5 matches
Mail list logo