[storm] How to check table exists?
Gerdus van Zyl
gerdusvanzyl at gmail.com
Thu Aug 14 11:40:01 BST 2008
I don't think storm can do that for you. The method to determine existing
tables differs from database to database. For instance in SQLlite it is
SELECT name FROM sqlite_master WHERE type='table'
and in Firebird
SELECT RDB$RELATION_NAME as name
FROM RDB$RELATIONS
WHERE RDB$SYSTEM_FLAG=0
AND RDB$VIEW_BLR IS NULL;
I always look at the source of php project adodb that does have database
introspection.
~Gerdus
On Thu, Aug 14, 2008 at 8:26 AM, Alexei Vinidiktov <
alexei.vinidiktov at gmail.com> wrote:
> Hello,
>
> How do I check when creating an instance of a class bound to a
> database whether the 1. underlying database and 2. the tables already
> exist (were created previously)?
>
> IIRC, in SQLAlchemy when creating tables you can write something like this:
>
> self.words.create(checkfirst=True)
> self.meanings.create(checkfirst=True)
> self.examples.create(checkfirst=True)
>
> Which creates the tables only if they don't exist.
>
> Storm doesn't have table generators so I wouldn't know what to do.
>
> Thanks.
>
> --
> Alexei Vinidiktov
>
> --
> storm mailing list
> storm at lists.canonical.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/storm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/storm/attachments/20080814/01b3a1db/attachment.htm
More information about the storm
mailing list