[sqlalchemy] Inspecting DDL of a Table object, without executing the code

2009-02-28 Thread Alex Willmer

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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Connecting with Windows Auth?

2009-02-28 Thread Alex Willmer

On Feb 25, 4:16 pm, Adam Pletcher adam.pletc...@gmail.com wrote:
 Is it possible to connect to a server using Windows Authentication
 using sqlalchemy?


Yes it is, the syntax is:

'mssql://hostname/database?trusted_connection=yes'

If you're connecting to a SQLEXPRESS instance, this becomes:

'mssql://hostname\\SQLEXPRESS/database?trusted_connection=yes'

I'm using pyodbc as the underlying DBAPI provider.

Alex

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---