views:

124

answers:

1

I create my trac enviromnets using a sqlite database, it works very well.

Now i want to get some information directly from the database and i'm using C# to do it using System.Data.SQLite. The problem i have is an error in the designer cause the tables don't have primary keys.

After get this error i went and noticed that all tables that have more than one primary key defined in the schema were not 'converted' to sqlite, that information is lost.

I believe the problem is in sqlite_backend.py but python isn't my speciality and i'm in a hurry so if you can guide me to a quick fix. thank you.

UPDATE (litle more detail):

System.Data.SQLite

"Support for the ADO.NET 3.5 Entity Framework Supports nearly all the entity framework functionality that Sql Server supports, and passes 99% of the tests in MS's EFQuerySamples demo application."

Visual Studio 2005/2008 Design-Time Support You can add a SQLite connection to the Server Explorer, create queries with the query designer, drag-and-drop tables onto a Typed DataSet and more!

When i drag the tables to the designer, some tables don't make it to the designer. The reasos is,

"The table/view 'main.attachment' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it."

The problem is this, no entitys = no data.

UPDATE (more info):

My objective isn't change datamodel.

In trac schema the tables attachment, *auth_cookie*, enum, *node_change*, permission, session, *session_attribute*, *ticket_change*, *ticket_custom* are defined with primary keys.

When i browse the file trac.db (default) the tables aren't defined with the primary_keys specified in the schema.

I want a solution to solve this litle feature of trac sqlite db. I don't think it's the best solution edit the table after creation to add pk that aren't created.

UPDATE

Any ideia?!

A: 

You may want to look at the Trac Database API. It's written in Python, but you could probably rewrite it in C# fairly easily. At the very least it'll give you a starting point for finding your solution. http://trac.edgewall.org/wiki/TracDev/DatabaseApi

TheTodd