Reflecting stored procedure as first class model objects could be very 
useful. I would imagine those objects be Python callable bound to an engine 
or session.

On Tuesday, August 16, 2016 at 10:28:25 AM UTC-4, Mike Bayer wrote:
>
>
>
> On 08/16/2016 03:33 AM, Chris Withers wrote: 
> > Gotcha, would there be any interest in adding StoredProcedure objects? 
>
> I wouldn't rush to doing that.   it's not clear what these objects would 
> do that DDL() doesn't and also I'd want to address triggers at the same 
> time.  See 
> http://alembic.zzzcomputing.com/en/latest/cookbook.html#replaceable-objects 
> for some of what would be needed. 
> > 
> > For the immediate need of "drop everything", your suggestion sounds like 
> > the best way forward, but I wonder if solving the more generic 
> > "reflecting stored procedures" problem might help with other things... 
>
> just the names is much simpler.  inspector.get_stored_procedure_names(), 
> much easier add. 
>
>
> > 
> > Have any tools emerged for comparing two databases' schemas? I guess the 
> > stuff used to auto-generate migrations must largely solve this problem? 
>
> alembic's API can be used for that to a partial extent.  there are also 
> some other rough approaches on pypi some of which have SQLAlchemy in 
> there and some do not. 
>
>
>
> > 
> > Sorry, I'm a bit rambly this morning... 
> > 
> > 
> > On 15/08/2016 14:38, Mike Bayer wrote: 
> >> 
> >> 
> >> We should have reflection for PG ENUM in there already.   SP names and 
> >> such, there's no "stored procedure" object, so if you wanted it to 
> >> look like the thing you see here you'd make a StoredProcedure() class 
> >> that's a subclass of DDLElement, etc.  I don't know that there's a 
> >> hook to add new methods to the Inspector() as of yet though.  If 
> >> you're just looking for a "drop everything" method I'd probably forego 
> >> all that boilerplate and just have "drop_pg_sps", "drop_mysql_sps", 
> >> etc. functions and key them off of engine.name in a dictionary or 
> >> something. 
> >> 
> >> 
> >> 
> >> On 08/15/2016 06:16 AM, Chris Withers wrote: 
> >>> Hi All, 
> >>> 
> >>> What's the best way (preferably database agnostic) to reflect stored 
> >>> procedure names, enums names and other non-table-specific items? 
> >>> 
> >>> I'm trying to improve this function, which is based on Mike's original 
> >>> recipe: 
> >>> 
> >>> 
> https://github.com/Mortar/mortar_rdb/blob/eb99d549be02643d4d670db2ee52b93b0c386fb4/mortar_rdb/__init__.py#L134
>  
> >>> 
> >>> 
> >>> 
> >>> I'd like to expand to to basically delete as much as possible in a 
> >>> database to give a clean starting ground for tests... 
> >>> 
> >>> Chris 
> >>> 
> >> 
> > 
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to