[sqlalchemy] sqlalchemy reflection

2010-03-31 Thread Tan Yi
quick question: for sqlalchemy+ms sql server, what kind of
accessibility does it need to do table reflection?

What I am trying to do is that I try to reflect a table from an
existing database, and I successfully created an engine. But I got
following exception:
raise exc.DBAPIError.instance(None, None, e)
sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42000', '[42000]
[Microsof
t][ODBC SQL Server Driver][SQL Server]Cannot open database
HisTpwdCoastal requ
ested by the login. The login failed. (4060) (SQLDriverConnectW);
[42000] [Micro
soft][ODBC SQL Server Driver][SQL Server]Cannot open database
HisTpwdCoastal r
equested by the login. The login failed. (4060)') None None

The connection string to mssql server only has delete, insert, and
update capabilities .
Wondering if any more capabilities needed.
Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@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] SqlAlchemy reflection error in TurboGears 2

2009-06-03 Thread Mike

Hi,

I am working on a TurboGears 2 application that uses SqlAlchemy 0.5.1.
I am using reflection and am having a lot of trouble with it. Anyway,
here's the error I am getting:


Traceback (most recent call last):
  File V:\PythonPackages\Development\pyRetention\Scripts\paster-
script.py, line 8, in module
load_entry_point('pastescript==1.7.3', 'console_scripts', 'paster')
()
  File v:\pythonpackages\development\pyretention\lib\site-packages
\pastescript-1.7.3-py2.5.egg\past
e\script\command.py, line 84, in run
invoke(command, command_name, options, args[1:])
  File v:\pythonpackages\development\pyretention\lib\site-packages
\pastescript-1.7.3-py2.5.egg\past
e\script\command.py, line 123, in invoke
exit_code = runner.run(args)
  File v:\pythonpackages\development\pyretention\lib\site-packages
\pastescript-1.7.3-py2.5.egg\past
e\script\appinstall.py, line 68, in run
return super(AbstractInstallCommand, self).run(new_args)
  File v:\pythonpackages\development\pyretention\lib\site-packages
\pastescript-1.7.3-py2.5.egg\past
e\script\command.py, line 218, in run
result = self.command()
  File v:\pythonpackages\development\pyretention\lib\site-packages
\pastescript-1.7.3-py2.5.egg\past
e\script\appinstall.py, line 456, in command
self, config_file, section, self.sysconfig_install_vars
(installer))
  File v:\pythonpackages\development\pyretention\lib\site-packages
\pastescript-1.7.3-py2.5.egg\past
e\script\appinstall.py, line 598, in setup_config
mod.setup_app, command, filename, section, vars)
  File v:\pythonpackages\development\pyretention\lib\site-packages
\pastescript-1.7.3-py2.5.egg\past
e\script\appinstall.py, line 612, in _call_setup_app
func(command, conf, vars)
  File D:\pyRetention\pyRetention\pyretention\websetup.py, line 18,
in setup_app
load_environment(conf.global_conf, conf.local_conf)
  File v:\pythonpackages\development\pyretention\lib\site-packages
\turbogears2-2.0-py2.5.egg\tg\con
figuration.py, line 438, in load_environment
self.setup_sqlalchemy()
  File v:\pythonpackages\development\pyretention\lib\site-packages
\turbogears2-2.0-py2.5.egg\tg\con
figuration.py, line 393, in setup_sqlalchemy
self.package.model.init_model(engine)
  File D:\pyRetention\pyRetention\pyretention\model\__init__.py,
line 64, in init_model
autoload_with=engine)
  File v:\pythonpackages\development\pyretention\lib\site-packages
\sqlalchemy-0.5.1-py2.5.egg\sqlal
chemy\schema.py, line 113, in __call__
return type.__call__(self, name, metadata, *args, **kwargs)
  File v:\pythonpackages\development\pyretention\lib\site-packages
\sqlalchemy-0.5.1-py2.5.egg\sqlal
chemy\schema.py, line 239, in __init__
autoload_with.reflecttable(self, include_columns=include_columns)
  File v:\pythonpackages\development\pyretention\lib\site-packages
\sqlalchemy-0.5.1-py2.5.egg\sqlal
chemy\engine\base.py, line 1265, in reflecttable
self.dialect.reflecttable(conn, table, include_columns)
  File v:\pythonpackages\development\pyretention\lib\site-packages
\sqlalchemy-0.5.1-py2.5.egg\sqlal
chemy\databases\mssql.py, line 1157, in reflecttable
coltype = coltype(*args, **kwargs)
TypeError: __init__() takes at most 2 arguments (3 given)


I'm not sure what it is talking about. Here are my sample tables
though:


tbl_checks = Table(tableOne, metadata, autoload=True,
   autoload_with=engine)
mapper(Checks, tbl_checks)

tbl_test = Table(tableTwo, metadata, autoload=True,
 autoload_with=engine,
 schema=DBName.dbo)
mapper(Test, tbl_test)


My databases were provided by a vendor and are on Microsoft SQL Server
2000. By analyzing my code in WingWare's debugger, it looks like the
first table is getting reflected correctly in the line
self.dialect.reflecttable(conn, table, include_columns) at least.

Any pointers would be great. I am using Python 2.5 if that matters.

Thanks!

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