Opened 7 years ago

Closed 7 years ago

#8594 closed (duplicate)

Add a model Meta parameter to prevent from table creation

Reported by: guneeyoufix Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords: syncdb, table, view, oracle, Meta
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I'm working with an existing oracle database, and I can't use the syncdb tool because in have views in my schema. Making requests to these views is not a problem at all, but syncdb only looks for tables, and since some of the classes in my model are referring to views, syncdb doesn't find them. In the syncdb logic, since the table doesn't exist, it has to be created. But there is already an object with this name (the view) and therefore, syncdb fails.

Therefore, since I cannot run syncdb, the list of permissions I can grant to my users is not being updated. I guess I could add all the permissions by hand, and that's I will do if there is no other solution.

However I was thinking of a trick that might not be so difficult to implement for you, and that would allow me (and of course other users in the same situation) to run syncdb successfully, and keep the functions given by the utility running.

What I'm suggesting is that a flag (basically a boolean) is added to the list of Meta parameters.
Let's call it create_table.
The flag would be set to True by default, and would mean that when you run syncdb, syncdb will attempt to create the table if it doesn't exist.
If set to False, then syncdb wouldn't try to create the table, and would carry on its job, part of which is to update the list of permissions.

I think it makes sense to implement this, in the sense that, when you work with an exisitng database, you basically know that the tables are created.

There might be another solution to the issue (for example adding an option to the syncdb utility which would tell it not to try to create tables, for example), but I haven't studied te django code enough to be able to tell which is the best.

Thank you for looking into it.

Change History (1)

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Dupe of #3163.

Note: See TracTickets for help on using tickets.
Back to Top