On Jan 29, 2013, at 11:01 AM, jank wrote:

> ok, it is worse thank I thought :) 
> 
> In the connection string in setup.cfg I pass the schema 'SQLA_TEST'. The DB 
> instance happen to have a bunch of other integration test schemas. One of 
> them contains a table named 'TEST_TABLE'. The test case calls 
> has_table('TEST_TABLE', schema=None) which returns true as such a table 
> exists (in some other schema).
> 
> I will try to check for the pre-condition that schema must be provided or is 
> set to SYS if it is None. I assume that this will break lots of test cases.
> 
> Btw, even with logging turned on I do not see any CREATE TABLE statement. 
> When exactly are the tables in the define_table() function of the test case 
> created?

it emits CREATE TABLE after it does has_table() and determines that the table 
doesn't exist.  So if your has_table() is returning True then you won't see it.


it might be worthwhile to drop down to an individual test for this just to see 
it working:


e = create_engine("your_dialect:// ...", echo=True)

m = MetaData()
t = Table('mytable', m, Column('id', Integer, primary_key=True))

t.create(e, checkfirst=False)   # will emit CREATE TABLE unconditionally
t.drop(e, checkfirst=False)

# then test with has_table:

assert not e.has_table('mytable')

t.create(e, checkfirst=True)
t.drop(e, checkfirst=True)

assert not e.has_table('mytable')




-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to