>
> I'm not completely sure what you're trying to do, but I have a blog
> entry on creating temporary models programmatically - it might help
> you:http://blog.roseman.org.uk/2010/04/13/temporary-models-django/

What I'm trying to do is to shard my database horizontally.

For example say I have a model Tweet and I want to shard it into N
tables using the modulo N of the user.id

So now I have N different models of Tweet: Tweet0, Tweet1, Tweet2, ...
each has the same structure, differing only in names.

I could type out the N models by hand:

class Tweet0(models.Model):
    content = models.CharField(max_length=140)
    datetime = models.DateTimeField()
    ...

class Tweet1(models.Model):
    content = models.CharField(max_length=140)
    datetime = models.DateTimeField()
    ...

class Tweet2(models.Model):
    content = models.CharField(max_length=140)
    datetime = models.DateTimeField()
    ...

And I'd have to repeat that N times.

Just wanted to see if there's a way to generate those N models
programmatically (perhaps using a for loop) instead of typing them out
manually.

-- 
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