Any notion of how one might instruct SQLAlchemy to (conditionally) create 
tables using UNLOGGED?

I'd like to be able to modify the DDL for all CREATE TABLE statements under 
certain conditions (dialect=postgresql & testing=True)
If not under test, then there would be no need to modify CREATE TABLE.

I'm thinking that it might involve some kind of before_create event and 
modifying the DDL, e.g. something that might start like:

event.listen(
    metadata,
    'before_create',
    DDL('CREATE UNLOGGED TABLE').execute_if(dialect='postgresql', 
callable_=isUnderTest, state=TESTING)

Does this seem like the right direction?




On Monday, July 11, 2011 11:19:39 PM UTC-7, Eric Ongerth wrote:
>
> ! Nothing to see here, move right along ! 
>
> Except... Couple of interesting additions coming up in PostgreSQL 9.1 
> (still in beta) for anyone who's interested.  Release notes: 
> http://developer.postgresql.org/pgdocs/postgres/release-9-1.html   A 
> couple of selected items I found of interest: 
>
> * New support for CREATE UNLOGGED TABLE -- a new type of table that is 
> sort of in between temporary tables and ordinary tables.  They are not 
> crash-safe as they are not written to the write-ahead log and are not 
> replicated if you have replication set up, but the tradeoff is they 
> can be written to a lot faster.  Could use these to speed up testing, 
> or in other non-production scenarios where crashproofness is not a 
> concern. 
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to