Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

#12105 closed defect (fixed)

Add get_table_names method to DatabaseManager

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.6
Component: database backend Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

New method for retrieving database table names: DatabaseManager.get_table_names().

Internal Changes:

Description

It would be useful to have a get_table_names method on DatabaseManager. The method would just be a helper that calls get_table_names on the ConnectionBase class, similar to how DatabaseManager.reset_tables directly calls reset_tables on the ConnectionBase class: tags/trac-1.1.5/trac/db/api.py@:393-394#L386.

Attachments (0)

Change History (4)

comment:1 by Ryan J Ollos, 9 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:2 by Ryan J Ollos, 9 years ago

comment:3 by Jun Omae, 9 years ago

I think we should compare table names of default_schema and the result of DatabaseManager.get_table_names(), e.g. for case get_table_names() returns unnecessary names.

  • trac/db/tests/api.py

    diff --git a/trac/db/tests/api.py b/trac/db/tests/api.py
    index 6402f44..f445e37 100644
    a b class DatabaseManagerTestCase(unittest.TestCase):  
    520520
    521521    def test_get_table_names(self):
    522522        """Get table name for the default database."""
    523         table_names = self.dbm.get_table_names()
    524         for table in default_schema:
    525             self.assertIn(table.name, table_names)
     523        self.assertEqual(sorted(table.name for table in default_schema),
     524                         sorted(self.dbm.get_table_names()))
    526525
    527526    def test_set_default_database_version(self):
    528527        """Set database version for the default entry named

comment:4 by Ryan J Ollos, 9 years ago

API Changes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for reviewing. Committed to trunk in [14114].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.