#734: "no such table: tg_user " error
---------------------------+------------------------------------------------
Reporter: Italo.Maia | Owner: anonymous
Type: defect | Status: closed
Priority: normal | Milestone: 0.9a5
Component: Identity | Version: 0.9a4
Severity: blocker | Resolution: invalid
Keywords: tg_user, user |
---------------------------+------------------------------------------------
Comment (by [EMAIL PROTECTED]):
What wiki recommendations?
I'm trying this code:
{{{
from sqlobject import *
from datetime import datetime
from turbogears.database import PackageHub
from turbogears.identity.soprovider import TG_User, TG_Group,
TG_Permission, TG_VisitIdentity
hub = PackageHub("buzzword")
__connection__ = hub
class Category(SQLObject):
name = UnicodeCol(unique=True,notNone=True)
description = UnicodeCol()
icon = BLOBCol()
posts = RelatedJoin("Post")
class Author(TG_User):
hackergotchi = BLOBCol()
url = UnicodeCol()
posts = MultipleJoin("Post",joinColumn='author_id')
comments = MultipleJoin("Comment",joinColumn='author_id')
class Group(TG_Group):
class sqlmeta:
table = 'bz_group'
pass
class Permission(TG_Permission):
pass
class VisitIdentity(TG_VisitIdentity):
pass
class Comment(SQLObject):
title = UnicodeCol()
content = UnicodeCol(notNone=True)
timestamp = DateTimeCol(default=datetime.now)
post = ForeignKey("Post")
author = ForeignKey("Author")
visitor = ForeignKey("Visitor")
class Post(SQLObject):
timestamp = DateTimeCol(default=datetime.now)
title = UnicodeCol()
content = UnicodeCol()
author = ForeignKey("Author")
categories = RelatedJoin("Category")
display = BoolCol(default="True")
comments = MultipleJoin("Comment",joinColumn='post_id')
class Visitor(SQLObject):
name = UnicodeCol(notNone=True)
email = UnicodeCol(unique=False,notNone=True)
url = UnicodeCol()
comments = MultipleJoin("Comment",joinColumn='visitor_id')
}}}
And tg-admin sql create generates this:
{{{
sqlite> .dump
BEGIN TRANSACTION;
CREATE TABLE author (
id INTEGER PRIMARY KEY,
hackergotchi TEXT,
url TEXT,
child_name VARCHAR(255)
);
CREATE TABLE category (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL UNIQUE,
description TEXT,
icon TEXT
);
CREATE TABLE category_post (
category_id INT NOT NULL,
post_id INT NOT NULL
);
CREATE TABLE comment (
id INTEGER PRIMARY KEY,
title TEXT,
content TEXT NOT NULL,
timestamp TIMESTAMP,
post_id INT CONSTRAINT post_id_exists REFERENCES post(id) ,
author_id INT CONSTRAINT author_id_exists REFERENCES author(id) ,
visitor_id INT CONSTRAINT visitor_id_exists REFERENCES visitor(id)
);
CREATE TABLE bz_group (
id INTEGER PRIMARY KEY,
child_name VARCHAR(255)
);
CREATE TABLE permission (
id INTEGER PRIMARY KEY,
child_name VARCHAR(255)
);
CREATE TABLE post (
id INTEGER PRIMARY KEY,
timestamp TIMESTAMP,
title TEXT,
content TEXT,
author_id INT CONSTRAINT author_id_exists REFERENCES author(id) ,
display TINYINT
);
CREATE TABLE visit_identity (
id INTEGER PRIMARY KEY,
visit_key VARCHAR(40) NOT NULL UNIQUE,
user_id INT
);
CREATE TABLE visitor (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL,
url TEXT
);
COMMIT;
}}}
I'm a bit lost.
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/734>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" 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/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---