i missed the schema nature of the issue on my first read.

on the trunk, this small patch to ansisql.py should do the trick

Index: ansisql.py
===================================================================
--- ansisql.py  (revision 1711)
+++ ansisql.py  (working copy)
@@ -660,7 +660,7 @@
              self.append("CONSTRAINT %s " % constraint.name)
          self.append("FOREIGN KEY(%s) REFERENCES %s (%s)" % (
              string.join([f.parent.name for f in constraint.elements], ',  
'),
-            list(constraint.elements)[0].column.table.name,
+            list(constraint.elements)[0].column.table.fullname,
              string.join([f.column.name for f in constraint.elements], ',  
')
          ))
          if constraint.ondelete is not None:


On Mon, 17 Jul 2006 13:11:00 -0700, Randall Smith <[EMAIL PROTECTED]> wrote:

> I installed 0.2.4 and it worked properly.  Then I installed 0.2.5 and it
> worked properly also, so I'm not sure what caused the problem now.  I'll
> post back if I do figure it out.
>
> Randall
>
> Randall Smith wrote:
>> The following was done with SVN trunk 1712.
>>
>> I have a table defined as such:
>>
>> schemaname='web'
>> metadata = DynamicMetaData(name="web_metadata")
>>
>> visit_identities = Table("visit_identities", metadata,
>>      Column("id", INTEGER, primary_key=True),
>>      Column("visit_key", String(40), nullable=False, unique=True),
>>      Column("user_id", INTEGER, ForeignKey(users.c.id), index=True),
>>      schema=schemaname
>> )
>>
>> users is a table defined in the same way.  Notice the schema =
>> schemaname part.  When I map an engine to metadata and issue the  
>> command:
>>
>>      visit_identities.create()
>>
>> I get the following error:
>>
>> sqlalchemy.exceptions.SQLError: (ProgrammingError) relation "users" does
>> not exist
>>   '\nCREATE TABLE web.visit_identities (\n\tid SERIAL NOT NULL,
>> \n\tvisit_key VARCHAR(40) NOT NULL, \n\tuser_id INTEGER, \n\tPRIMARY KEY
>> (id), \n\t FOREIGN KEY(user_id) REFERENCES users (id)\n)\n\n' {}
>>
>> The create method is not taking into account the schema of users.  I
>> believe that previous versions of SA did take into account the schema
>> when a ForeignKey was defined with a direct reference.
>>
>> Randall
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share  
>> your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share  
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to