Opened 12 years ago

Closed 12 years ago

# Postgres not working

Reported by: Owned by: anonymous Sam Bloomquist normal ScrumBurndownPlugin critical nick.stone@… 0.9

### Description

The plug in doesn't work with postgres. The first error is at line 42 as this is clearly written for sqlite. The line is:

cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='burndown'")

Can you look into fixing that as we'd love to use the plugin otherwise

### comment:1 Changed 12 years ago by Sam Bloomquist

Ah, yes. I forgot about postgres. The only problem is that I only learned enough about the inner workings of Trac to get this plugin up and working for my own team. If someone else could point me toward the proper (database-independent) way to do this in Trac, I'd be happy to make the change.

### comment:2 Changed 12 years ago by Noah Kantrowitz

This may be of some help.

### comment:3 Changed 12 years ago by Sam Bloomquist

Resolution: → fixed new → closed

(In [1495]) Got rid of sqlite-specific call in BurndownComponent.environment_needs_upgrade().

fixes #846

### comment:4 Changed 12 years ago by Sam Bloomquist

Thanks for the tip, coderanger. That was easy enough. Sorry it took me so long to get to this. I haven't tested this with postgres, but it didn't break anything for sqlite. Please re-open this ticket if the fix didn't work.

For those who care, here is what the new code looks like:

        # See if the burndown table exists, if not, return True because we need to upgrade the database
cursor = db.cursor()
try:
cursor.execute('SELECT * FROM %s LIMIT 1', 'burndown')
except:


### comment:5 Changed 12 years ago by nickstone

Thanks for the fix - I'll have a play and let you know if there's any problems

### comment:6 Changed 12 years ago by Sam Bloomquist

Note the fix for this ticket has been included in the following egg version (which is now available on from the ScrumBurndownPlugin wiki page:

TracBurndown-01.03.10-py2.3.egg

### comment:7 follow-up:  8 Changed 12 years ago by anonymous

Is this what you meant:

cursor.execute('SELECT * FROM %s LIMIT 1' % 'burndown')

(Note '%' instead of comma ',' near burndown)

Chris

### comment:8 in reply to:  7 Changed 12 years ago by Sam Bloomquist

Is this what you meant:

cursor.execute('SELECT * FROM %s LIMIT 1' % 'burndown')

(Note '%' instead of comma ',' near burndown)

Chris

Either syntax should work. I went with the comma for consistency's sake.

### Modify Ticket

Change Properties