Re: [sqlalchemy] Bug in mssql dialect?
You are right. Thanks once again. On Mar 3, 2011, at 11:11, Michael Bayer wrote: > That looks certainly like a misconfigured relationship(). Not sure why > SQLite would let it pass through (sqlite is in general extremely liberal), > but that's clearly a literal string passed to a join expression sent to > relationship as in relationship(... primaryjoin=and_(some expression, > "Edge._discriminator=='use'")) or something like that. When using strings > for relationship(), the full expression must be a string, not the components. > > > > On Mar 3, 2011, at 10:55 AM, Michael Naber wrote: > >> Last line is invalid t-sql. The ‘==’ should just be ‘=’. I get the problem >> when using mssql but not with sqlite. Saw the bug on sqa version 0.6.6, >> upgraded to 0.7b2 and still having issue. Please let me know if you need >> more info and I'll be happy to provide. >> >> Thanks, >> Michael >> >> >> Traceback (most recent call last): >> File "C:\Program Files\eclipse-SDK-3.6.2-win32\eclipse\dropins\Pydev >> 1.6.5\plugins\org.python.pydev.debug_1.6.5.2011020317\pysrc\pydevd.py", line >> 1133, in >> debugger.run(setup['file'], None, None) >> File "C:\Program Files\eclipse-SDK-3.6.2-win32\eclipse\dropins\Pydev >> 1.6.5\plugins\org.python.pydev.debug_1.6.5.2011020317\pysrc\pydevd.py", line >> 918, in run >> execfile(file, globals, locals) #execute the script >> File "C:\OpsPylonDev\TransformationBA-Trunk\pydev-setup-app.py", line 5, >> in >> SetupCommand('setup-app').run(['development.ini']) >> File >> "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\appinstall.py", >> line 68, in run >> return super(AbstractInstallCommand, self).run(new_args) >> File >> "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\command.py", >> line 218, in run >> result = self.command() >> File >> "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\appinstall.py", >> line 456, in command >> self, config_file, section, self.sysconfig_install_vars(installer)) >> File >> "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\appinstall.py", >> line 598, in setup_config >> mod.setup_app, command, filename, section, vars) >> File >> "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\appinstall.py", >> line 612, in _call_setup_app >> func(command, conf, vars) >> File "C:\OpsPylonDev\TransformationBA-Trunk\transformationba\websetup.py", >> line 34, in setup_app >> insert_data() >> File >> "C:\OpsPylonDev\TransformationBA-Trunk\transformationba\model\data\__init__.py", >> line 42, in insert_data >> inserter.insert() >> File "transformationba\model\data\inserters\400technology.py", line 23, in >> insert >> csharp_app.create_artifacts() >> File >> "C:\OpsPylonDev\TransformationBA-Trunk\transformationba\model\data\technology_data\csharp_app.py", >> line 65, in create_artifacts >> parent.uses.append(component) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\ext\associationproxy.py", >> line 189, in __get__ >> proxy = self._new(_lazy_collection(obj, self.target_collection)) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\ext\associationproxy.py", >> line 233, in _new >> self.collection_class = util.duck_type_collection(lazy_collection()) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\ext\associationproxy.py", >> line 335, in __call__ >> return getattr(obj, self.target) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\attributes.py", >> line 162, in __get__ >> return self.impl.get(instance_state(instance),dict_) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\attributes.py", >> line 414, in get >> value = self.callable_(state, passive) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\strategies.py", >> line 542, in _load_for_state >> result = q.all() >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\query.py", >> line 1636, in all >> return list(self) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\query.py", >> line 1746, in __iter__ >> return self._execute_and_instances(context) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\query.py", >> line 1752, in _execute_and_instances >> close_with_result=True).execute(querycontext.statement, self._params) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\engine\base.py", >> line 1259, in execute >> params) >> File >> "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\engine\base.py", >> line 1392, in _execute_clauseelement >> compiled_sql, distilled_params >>
Re: [sqlalchemy] Bug in mssql dialect?
That looks certainly like a misconfigured relationship(). Not sure why SQLite would let it pass through (sqlite is in general extremely liberal), but that's clearly a literal string passed to a join expression sent to relationship as in relationship(... primaryjoin=and_(some expression, "Edge._discriminator=='use'")) or something like that. When using strings for relationship(), the full expression must be a string, not the components. On Mar 3, 2011, at 10:55 AM, Michael Naber wrote: > Last line is invalid t-sql. The ‘==’ should just be ‘=’. I get the problem > when using mssql but not with sqlite. Saw the bug on sqa version 0.6.6, > upgraded to 0.7b2 and still having issue. Please let me know if you need more > info and I'll be happy to provide. > > Thanks, > Michael > > > Traceback (most recent call last): > File "C:\Program Files\eclipse-SDK-3.6.2-win32\eclipse\dropins\Pydev > 1.6.5\plugins\org.python.pydev.debug_1.6.5.2011020317\pysrc\pydevd.py", line > 1133, in > debugger.run(setup['file'], None, None) > File "C:\Program Files\eclipse-SDK-3.6.2-win32\eclipse\dropins\Pydev > 1.6.5\plugins\org.python.pydev.debug_1.6.5.2011020317\pysrc\pydevd.py", line > 918, in run > execfile(file, globals, locals) #execute the script > File "C:\OpsPylonDev\TransformationBA-Trunk\pydev-setup-app.py", line 5, in > > SetupCommand('setup-app').run(['development.ini']) > File > "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\appinstall.py", > line 68, in run > return super(AbstractInstallCommand, self).run(new_args) > File > "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\command.py", > line 218, in run > result = self.command() > File > "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\appinstall.py", > line 456, in command > self, config_file, section, self.sysconfig_install_vars(installer)) > File > "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\appinstall.py", > line 598, in setup_config > mod.setup_app, command, filename, section, vars) > File > "C:\Python27\lib\site-packages\pastescript-1.7.3-py2.7.egg\paste\script\appinstall.py", > line 612, in _call_setup_app > func(command, conf, vars) > File "C:\OpsPylonDev\TransformationBA-Trunk\transformationba\websetup.py", > line 34, in setup_app > insert_data() > File > "C:\OpsPylonDev\TransformationBA-Trunk\transformationba\model\data\__init__.py", > line 42, in insert_data > inserter.insert() > File "transformationba\model\data\inserters\400technology.py", line 23, in > insert > csharp_app.create_artifacts() > File > "C:\OpsPylonDev\TransformationBA-Trunk\transformationba\model\data\technology_data\csharp_app.py", > line 65, in create_artifacts > parent.uses.append(component) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\ext\associationproxy.py", > line 189, in __get__ > proxy = self._new(_lazy_collection(obj, self.target_collection)) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\ext\associationproxy.py", > line 233, in _new > self.collection_class = util.duck_type_collection(lazy_collection()) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\ext\associationproxy.py", > line 335, in __call__ > return getattr(obj, self.target) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\attributes.py", > line 162, in __get__ > return self.impl.get(instance_state(instance),dict_) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\attributes.py", > line 414, in get > value = self.callable_(state, passive) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\strategies.py", > line 542, in _load_for_state > result = q.all() > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\query.py", > line 1636, in all > return list(self) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\query.py", > line 1746, in __iter__ > return self._execute_and_instances(context) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\orm\query.py", > line 1752, in _execute_and_instances > close_with_result=True).execute(querycontext.statement, self._params) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\engine\base.py", > line 1259, in execute > params) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\engine\base.py", > line 1392, in _execute_clauseelement > compiled_sql, distilled_params > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py2.7.egg\sqlalchemy\engine\base.py", > line 1500, in _execute_context > context) > File > "C:\Python27\lib\site-packages\sqlalchemy-0.7b2-py