Warn user he's using ondelete on unsupported backend

Issue #1235 resolved
Anonymous created an issue

(original reporter: ged) From: http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_relation_largecollections_passivedelete

Note that "ON DELETE" is not supported on SQLite, and requires InnoDB tables when using MySQL.

I'd appreciate if SA would issue a Warning when issuing an ONDELETE clause to SQLite (which silently accepts it then silently fails to enforce it).

Comments (6)

  1. jek

    Just a note that cascades on MySQL require a storage engine that supports them, of which InnoDB is one. Unless MySQL provides an engine capability introspection API I doubt this can be implemented well for MySQL. A compromise may be to emit a warning only when creating a MyISAM table. It would require some server interaction to implement (check default-storage-engine, no_engine_substitution mode, show engines) but would address the most common error case.

  2. Michael Bayer repo owner

    another messy thing here is that theres all kinds of things "ignored" by backends, particularly MySQL and SQLite. CHECK constraint, FOREIGN KEY, etc. A lot. I don't know that I want this level of handholding present.

  3. Anonymous

    (original author: ged) I was going to +1 the idea, until I saw I was the one to ask for it in the first place :). Well, an option somewhere (eg kwarg to create_engine), would be nice, but I'm partial to this.

  4. Michael Bayer repo owner

    agree for now there's a whole host of things that are ignored on various backends (where by "various" we mean MySQL and SQLite) and the lack of referential integrity thing for those should be well understood.

  5. Log in to comment