getting db started out?

34 views
Skip to first unread message

Deuce868

unread,
Apr 13, 2007, 12:24:08 PM4/13/07
to tblog
I'm going through and getting Tblog working via svn. I want to poke
around at this and I've gotten everything up and running except the
db. When I try a tg-admin sql create I get the following error:
~/src/turboblog$ tg-admin sql create
This command needs to be run from inside a project directory

Looking at the model.py file you have some methods for going from
version to version of the model, is this part of the tg-migrations? Is
this just home grown db updating? Is there a different method I'm
missing to get started manually?

Thanks

Rick

Rick Harding

unread,
Apr 13, 2007, 2:25:45 PM4/13/07
to tblog


I played around some more and saw a bug related to a create_db.py? But I can't find that file anywhere. I also found that none of the tg-admin commands seem to work from the svn checkout I have done.

When I start the app I get:
sqlobject.dberrors.ProgrammingError: Table 'turboblog.tg_user' doesn't exist

In line try: 1049 which is just
    User.get(1)

That's surrounded in some try/catch, but not for the ProgrammingError thrown. If this was an OperationalError it would run create_model() though.

Hope this helps point down to where it is I should be going to get this running. I see the create

Florent Aide

unread,
Apr 13, 2007, 3:13:24 PM4/13/07
to tb-di...@googlegroups.com
> When I start the app I get:
> sqlobject.dberrors.ProgrammingError: Table
> 'turboblog.tg_user' doesn't exist
>
> In line try: 1049 which is just
> User.get(1)
>
> That's surrounded in some try/catch, but not for the ProgrammingError
> thrown. If this was an OperationalError it would run create_model() though.
>
> Hope this helps point down to where it is I should be going to get this
> running. I see the create
>

I'll check this right now :)

Basically the create_db script does not exist anymore and has been
replaced with the model.py own handling of db creation and upgrade.

The version to version code you see in model.py is a home grown way of
managing the updates from one db version to another...

You may miss some database driver and not see it clearly... Do you
have pysqlite installed on your machine ? if yes make sure libsqlite
(the C library) is also present.

If the database driver is present on your machine the model.py should
handle the creation of the initial database for you... I just tried
this from my working copy by removing my sqlite file and it works...

Hope it helps,

Florent.

Rick Harding

unread,
Apr 16, 2007, 8:07:42 AM4/16/07
to tb-di...@googlegroups.com


I'll check this right now :)

Basically the create_db script does not exist anymore and has been
replaced with the model.py own handling of db creation and upgrade.

The version to version code you see in model.py is a home grown way of
managing the updates from one db version to another...

You may miss some database driver and not see it clearly... Do you
have pysqlite installed on your machine ? if yes make sure libsqlite
(the C library) is also present.

If the database driver is present on your machine the model.py should
handle the creation of the initial database for you... I just tried
this from my working copy by removing my sqlite file and it works...

Hope it helps,


This does help a little. I was trying this with mysql and it doesn't work with my mysql db uri instead of a sqlite one. It did work with sqlite though. I do have python-mysqldb installed and running. So I noticed that it was throwing a ProgrammingError exception. I added a catch for that around line 1055 in the model.py.

except ProgrammingError:
    # mysql is throwing this exception and we need to create the db structure
    create_model()

Adding that got the tables created in mysql and everything running.

On a second note, any idea why some of the tg-admin commands won't work in the project? For instance tg-admin shell won't run, but toolbox will go.

Thanks for the help/pointers.

Rick


Rick Harding

unread,
Apr 16, 2007, 8:14:29 AM4/16/07
to tb-di...@googlegroups.com
On 4/16/07, Rick Harding <deuc...@gmail.com> wrote:


except ProgrammingError:
    # mysql is throwing this exception and we need to create the db structure
    create_model()

Adding that got the tables created in mysql and everything running.

Oh, I also had to import ProgrammingError in line 3 obviously.

Rick
Reply all
Reply to author
Forward
0 new messages