Re:PG: What's your current take on reddit's comment system?
by Jd on Friday July 13, 2007 @11:16PM
(#34164)
Is this what you are actually doing? How do you store the pickle output?
Re:PG: What's your current take on reddit's comment system?
by nostrademons on Saturday July 14, 2007 @10:28AM
(#34209)
I'm not - I'm using the approach here: http://news.ycombinator.com/item?id=33888 . That gives me much more flexibility in picking out individual comments from a thread, returning all comments by a specific user, getting all comments posted today, etc. I'm just recognizing this as another possible way to solve the problem, if you don't care about the extra functionality..
As for storing the pickled output:
dbh.execute('UPDATE articles SET comments = $comments WHERE news_id = $id',
comments=pickle.dumps(article.comments))
The comments field can be a normal TEXT field, since the default format for pickle is ASCII-based.
Many filesystems have trouble with large numbers of files in a single directory, as you'd get with eg. pickle tree to a file per item.