see the recipe in 
http://www.sqlalchemy.org/trac/wiki/FAQ#HowcanIgettheCREATETABLEDROPTABLEoutputasastring
 
  .

On Feb 27, 2009, at 4:32 AM, Alex Willmer wrote:

>
> I suspect the answer to this is obvious, but it eludes me. I have
> defined some SQlAlchemy table classes, using declarative_base, to
> interact with some tables in an SQL Server database. I'm unsure that
> the types I've chosen are correct.
>
> I want to print the CREATE TABLE ddl, without executing it. How can I
> do this?
>
> With thanks, Alex
>
> CONN_STR = 'mssql://user:p...@host/database'
> engine = sqlalchemy.create_engine(CONN_STR)
>
> Base = declarative_base()
>
> class LVService(Base):
>    '''Map service for LocalView Intranet.
>    '''
>    __tablename__ = 'localview_Services'
>    ServiceId =         Column(types.Integer,
>                               Sequence('service_id', 1, 1),
>                               primary_key=True,
>                               )
>    ServiceServer =     Column(types.String(50)) #nvarchar
>    ServiceType =       Column(types.String(50)) #nvarchar
>    ServiceDataFrame =  Column(types.String(50)) #nvarchar
>    ServiceUsername =   Column(types.String(50)) #nvarchar
>    ServicePassword =   Column(types.String(50)) #nvarchar
>    ServiceDomain =     Column(types.String(50)) #nvarchar
>    ServiceLayerManager = \
>                        Column(types.String(50)) #nvarchar
>    IsLive =            Column(types.Integer, nullable=False,
> default=1)
>    ServiceDisplayName = \
>                        Column(types.String(50)) #nvarchar
> ...
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to