Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #657 (closed defect: wontfix)

Opened 12 years ago

Last modified 11 years ago

"tg-admin sql create" copies external table to default database

Reported by: Bob T. (btaylorCOS@… Owned by: anonymous
Priority: normal Milestone: 1.5
Component: SQLObject Version:
Severity: normal Keywords: turbogears sqlobject create SQL external


TG 0.9a1, PostgreSQL 8, Linux FC4.

I have a local Postgres database which sqlobject.dburi is pointed to in my devcfg.py file. I also have another external database which I need to fetch data from. In the model.py file I have

conn = connectionForURI( "postgres://blah-blah") class exotable SQLObject ):

_connection = conn class sqlmeta:

fromDatabase = True

After running "tg-admin sql create" the exotable object points to the external database and has the right attributes. However, a copy of the schema for exotable (no data) has been created in the local database, along with the other sqlobject tables (not shown) that needed to be created in the local database.

I suspect this is a TG problem rather than a SQLObject problem, but I could be wrong.

Change History

comment:1 Changed 12 years ago by btaylorCOS@…

Ok, that sure munged my code (first ticket, I'm learning). Use this for the model code:

conn = connectionForURI( "postgres://---snip---")
class exotable SQLObject ):
    _connection = conn
    class sqlmeta:
        fromDatabase = True

comment:2 Changed 12 years ago by anonymous

  • Component changed from CherryPy to SQLObject

comment:3 Changed 11 years ago by jorge.vargas

  • Milestone set to 1.0

This is correct behavior

sqlobject-admin parses the file looking for classes, it shouldn't care about anything else. Since your using from database and there is nothing it's creating an empty table.

I can think of

  • making sqlobject-admin aware of the conn statements
  • making fromDatabase fail on an empty table

Now the problem I see is that your mixing 2 edge cases and getting an error this is very unlikely to get fix.

comment:4 Changed 11 years ago by alberto

  • Milestone changed from 1.0 to 1.1

comment:5 Changed 11 years ago by jorge.vargas

  • Status changed from new to closed
  • Resolution set to wontfix
Note: See TracTickets for help on using tickets.