Re: [sqlalchemy] Sqlalchemy sintax for a query with "not like" operator
Each column has a 'like' method, so you should be able to filter by it: filter(~Table.field.like("%value1%")) Hi to all, I need to realize a query like this select * from my_table where field not like "%value1%" and field not like "%value2%" with a sqlalchemy sintax. I looked for around the documentation but it seems be impossible. Am I wrong? It's possible that the only way could be to use the engine.execute method? Thanks for any suggestion Best regards Luca -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
[sqlalchemy] Re: Sqlalchemy sintax for a query with "not like" operator
i think this should work: query.filter( ~ table.column.contains('%value2%') ) -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
[sqlalchemy] Sqlalchemy sintax for a query with "not like" operator
Hi to all, I need to realize a query like this select * from my_table where field not like "%value1%" and field not like "%value2%" with a sqlalchemy sintax. I looked for around the documentation but it seems be impossible. Am I wrong? It's possible that the only way could be to use the engine.execute method? Thanks for any suggestion Best regards Luca -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
Re: [sqlalchemy] timing / profiling object loading ?
On Thursday, September 26, 2013 11:58:26 AM UTC-4, Michael Bayer wrote: > > That's why I don't have a caching function included with SQLAlchemy. > Because then I'd be debugging it, not you :) > Ha! My caching is pretty lightweight. I do need to figure out a better system though -- that's for post-launch / investing though ! I'll toss you a preview when it's close to launch. It's built on quite a bit of Bayer-Tech. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
Re: [sqlalchemy] timing / profiling object loading ?
That's why I don't have a caching function included with SQLAlchemy. Because then I'd be debugging it, not you :) On Sep 26, 2013, at 11:38 AM, Jonathan Vanasco wrote: > Thanks. > > I caved in and stayed up until 3am last night to add a ton of log.debug() > statements across the app. > > The culprit was my read-through-caching layer ( built on dogpile ). It was > implemented in such a way that SqlAlchemy looked to have issues. > > The performance on the DBM datatstore was less than ideal. I haven't benched > the pylibmc version yet ( which is running on production ). > > GETs performed fine ( slower than I expected, but generally fine ). The SET > operations were a killer though. The speed on this machine was something > like 50/s GET vs 10/s SET. With a DBM backend, a "moderate" page is taking > 3.5s to generate on an unprimed cache; the same page on a memory backend... > .05 s. hitting a fully primed cache was taking under .05s on both backends. > > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/groups/opt_out. signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [sqlalchemy] timing / profiling object loading ?
Thanks. I caved in and stayed up until 3am last night to add a ton of log.debug() statements across the app. The culprit was my read-through-caching layer ( built on dogpile ). It was implemented in such a way that SqlAlchemy looked to have issues. The performance on the DBM datatstore was less than ideal. I haven't benched the pylibmc version yet ( which is running on production ). GETs performed fine ( slower than I expected, but generally fine ). The SET operations were a killer though. The speed on this machine was something like 50/s GET vs 10/s SET. With a DBM backend, a "moderate" page is taking 3.5s to generate on an unprimed cache; the same page on a memory backend... .05 s. hitting a fully primed cache was taking under .05s on both backends. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
Re: [sqlalchemy] [SA0.7] Possible feature request for subqueryload?
Thank you for pointing this out! I did not realize that it has such a consequencies, though it is perfectly logical. My bad. All joinedloads are part of the main query now, as they should. Also, ignore my remark about Tag info being not loaded. When there actually are any tags, they get loaded as expected (though I stil don't understand why the SQL is different in both cases). The only thing remaining is that the following subqueryloads are loaded in isolation: > subqry -> /subject/contacts/ > subqry -> /subject/contacts/contact_personal/ > subqry -> /subject/contacts/contact_personal/contact_address/ > subqry -> /subject/contacts/contact_personal/permanent_address/ And I just realized / understood why! Because subqueryload uses JOIN and all above relations can be NULL. Is this correct? I have two types of contacts, personal and corporate. The above loads: * ALL Subject.contacts (i.e. personal AND CORPORATE) * The rest only work with the personal. Thank you very much! It has been enlightening as always, Ladislav Lenart On 26.9.2013 16:13, Michael Bayer wrote: > > On Sep 26, 2013, at 9:30 AM, Ladislav Lenart wrote: > >> >> Your thoughts on this? Do you see anything suspicious? >> >> BTW the new system for 0.9 looks very nice! > > OK I only started reading the first few queries, but immediately what I think > is causing confusion here is that your loading options are conflicting with > each other, so the joinedload() you're looking for at the top is being > partially cancelled out: > > session.query(Partner).filter( >Partner.id.in_(win) > ).options( >joinedload(Partner.subject, innerjoin=True), >joinedload(Partner.subject, Subject.subject_personal, innerjoin=True), >joinedload(Partner.subject, Subject.subject_personal, > SubjectPersonal.address), >subqueryload(Partner.subject, Subject.contacts), >subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal), >subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal, > ContactPersonal.contact_address), >subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal, > ContactPersonal.permanent_address), >subqueryload_all(Partner.subject, Subject.tag_subjects, TagSubject.tag), >subqueryload_all(Partner.partner_regions), > ) > > > the directive subqueryload_all(Partner.subject, Subject.tag_subjects, > TagSubject.tag) is after the joinedloads you have above, so the > joinedload(Partner.subject) is cancelled out by that, hence all the > additional joinedload() that build on top of that is pushed out to be part of > the subqueryloads. > > you can read these directives just like paths. The "path" is a unique key in > a dictionary. as the loading traverses along each relationship, it looks up > the path, and the kind of loader called for. the above is the equivalent of: > > joined -> /subject/ > joined -> /subject/subject_personal/ > joined -> /subject/subject_personal/address/ > subqry -> /subject/contacts/ > subqry -> /subject/contacts/contact_personal/ > subqry -> /subject/contacts/contact_personal/contact_address/ > subqry -> /subject/contacts/contact_personal/permanent_address/ > subqry -> /subject/ (overrides the joined) > subqry -> /subject/tag_subjects/ > subqry -> /subject/tag_subjects/tag/ > subqry -> /partner_regions/ > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
Re: [sqlalchemy] pymssql connect mssql server
this bug report for pymssql is nearing two years old. Please get a more recent version of pymssql as directed in the comments on that ticket: https://bugs.launchpad.net/ubuntu/+source/pymssql/+bug/918896/comments/5 apt-get uninstall python-pymssql; pip install pymssql On Sep 26, 2013, at 5:58 AM, 零五 wrote: > http://stackoverflow.com/questions/7250464/python-and-pymssql > https://bugs.launchpad.net/ubuntu/+source/pymssql/+bug/918896 > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/groups/opt_out. signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [sqlalchemy] [SA0.7] Possible feature request for subqueryload?
On Sep 26, 2013, at 9:30 AM, Ladislav Lenart wrote: > > Your thoughts on this? Do you see anything suspicious? > > BTW the new system for 0.9 looks very nice! OK I only started reading the first few queries, but immediately what I think is causing confusion here is that your loading options are conflicting with each other, so the joinedload() you're looking for at the top is being partially cancelled out: session.query(Partner).filter( Partner.id.in_(win) ).options( joinedload(Partner.subject, innerjoin=True), joinedload(Partner.subject, Subject.subject_personal, innerjoin=True), joinedload(Partner.subject, Subject.subject_personal, SubjectPersonal.address), subqueryload(Partner.subject, Subject.contacts), subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal), subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal, ContactPersonal.contact_address), subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal, ContactPersonal.permanent_address), subqueryload_all(Partner.subject, Subject.tag_subjects, TagSubject.tag), subqueryload_all(Partner.partner_regions), ) the directive subqueryload_all(Partner.subject, Subject.tag_subjects, TagSubject.tag) is after the joinedloads you have above, so the joinedload(Partner.subject) is cancelled out by that, hence all the additional joinedload() that build on top of that is pushed out to be part of the subqueryloads. you can read these directives just like paths. The "path" is a unique key in a dictionary. as the loading traverses along each relationship, it looks up the path, and the kind of loader called for. the above is the equivalent of: joined -> /subject/ joined -> /subject/subject_personal/ joined -> /subject/subject_personal/address/ subqry -> /subject/contacts/ subqry -> /subject/contacts/contact_personal/ subqry -> /subject/contacts/contact_personal/contact_address/ subqry -> /subject/contacts/contact_personal/permanent_address/ subqry -> /subject/ (overrides the joined) subqry -> /subject/tag_subjects/ subqry -> /subject/tag_subjects/tag/ subqry -> /partner_regions/ signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [sqlalchemy] pymssql connect mssql server
what is the actual SQL Server version there as well as what FreeTDS are you running On Sep 26, 2013, at 5:58 AM, 零五 wrote: > http://stackoverflow.com/questions/7250464/python-and-pymssql > https://bugs.launchpad.net/ubuntu/+source/pymssql/+bug/918896 > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/groups/opt_out. signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [sqlalchemy] timing / profiling object loading ?
the profiling will show you if there's some network/server overhead from fetching rows, if you can see where psycopg2 is actually doing that. On Sep 26, 2013, at 2:44 AM, Jonathan Vanasco wrote: > yeah. painfully slow. > > i can't seem to recreate this on a test script. it happens every so often in > a pyramid app , but I can't recreate it on a bootstrapped (command line) > pyramid instance. my test suite shows this happening instantly. > > this has been troubling me for over a week since i noticed ( hence all my > profiling concerns and query rewriting ) > > i've got the raw queries down to a matter of milliseconds. sqlalchemy seems > to do the roundtrip with no overhead. every so often, the web-enabled > version just hangs for a few seconds -- right after data comes in from > Postgres [ i've been watching the logs like an eagle ]. > > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/groups/opt_out. signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [sqlalchemy] [SA0.7] Possible feature request for subqueryload?
Hello. On 25.9.2013 17:15, Michael Bayer wrote: > > On Sep 25, 2013, at 10:11 AM, Ladislav Lenart wrote: > >> Hello. >> >> Would it be possible to make these two forms >> >>session.query(cls).options( >>subqueryload(cls.foos), >>subqueryload(cls.foos, Foo.bar), >>) >> >> and >> >>session.query(cls).options( >>subqueryload_all(cls.foos, Foo.bar) >>) >> >> completely equivalent, i.e. subqueryload_all being just a shortcut of the >> former >> if the paths have the above pattern (i.e. if one subqueryload is subsumed by >> another)? > > unless there's some bug I'm unaware of, those two forms are exactly > equivalent. XYZload_all("a.b.c") is a shortcut to XYZload("a"), > XYZLoad("a.b"), XYZLoad("a.b.c").In 0.9 I'm working out a new system > backing the loader options that will allow more intuitive patterns, e.g. > load(cls).subqueryload("foos").subqueryload("bar"). Hmm, that's not what I see here. I captured SQL Alchemy debug log (echo=True) of one such query and modified it to be easier to read, added corresponding python code and also my remarks/questions. Please look at it, though it's rather long... First, a query that returns ids of ALL Partner instances of the result (this is how I do windowed queries). [python] session.query(distinct(Partner.id)).filter( Partner.visible == True, Partner.sponsor_id == self.id, ) [sql] SELECT DISTINCT partner.id AS anon_1 FROM partner WHERE partner.visible = true AND partner.sponsor_id = %(sponsor_id_1)s This result list of (partner) ids is then divided to windows of size 100. Each window is queried individually. Following are the queries to completely populate one such window. Main query to populate data of max 100 partners (one window). [python] # win is a list of 100 ids. session.query(Partner).filter( Partner.id.in_(win) ).options( joinedload(Partner.subject, innerjoin=True), joinedload(Partner.subject, Subject.subject_personal, innerjoin=True), joinedload(Partner.subject, Subject.subject_personal, SubjectPersonal.address), subqueryload(Partner.subject, Subject.contacts), subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal), subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal, ContactPersonal.contact_address), subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal, ContactPersonal.permanent_address), subqueryload_all(Partner.subject, Subject.tag_subjects, TagSubject.tag), subqueryload_all(Partner.partner_regions), ) [sql] SELECT partner.state AS partner_state, partner.position AS partner_position, partner.own_points AS partner_own_points, partner.net_points AS partner_net_points, partner.net_admin AS partner_net_admin, partner.team_leader AS partner_team_leader, partner.bazaar_owner AS partner_bazaar_owner, partner.bazaar_extractor AS partner_bazaar_extractor, partner.desired_team_leader AS partner_desired_team_leader, partner.desired_bazaar_owner AS partner_desired_bazaar_owner, partner.desired_bazaar_extractor AS partner_desired_bazaar_extractor, partner.visible AS partner_visible, partner.sms_credits AS partner_sms_credits, partner.id AS partner_id, partner.external_id AS partner_external_id, partner.subject_id AS partner_subject_id, partner.sponsor_id AS partner_sponsor_id, partner.team_id AS partner_team_id, partner.bazaar_id AS partner_bazaar_id, partner.higher_bazaar_id AS partner_higher_bazaar_id FROM partner WHERE partner.id IN (...) [python] joinedload(Partner.subject, innerjoin=True), joinedload(Partner.subject, Subject.subject_personal, innerjoin=True), joinedload(Partner.subject, Subject.subject_personal, SubjectPersonal.address, innerjoin=True), corresponds to [sql] SELECT subject.created_at AS subject_created_at, subject.id AS subject_id, subject.subject_personal_id AS subject_subject_personal_id, subject.subject_corporate_id AS subject_subject_corporate_id, subject.creator_id AS subject_creator_id, anon_1.partner_subject_id AS anon_1_partner_subject_id, address_1.street AS address_1_street, address_1.postal_code AS address_1_postal_code, address_1.city AS address_1_city, address_1.country AS address_1_country, address_1.id AS address_1_id, subject_personal_1.title_prefix AS subject_personal_1_title_prefix, subject_personal_1.title_suffix AS subject_personal_1_title_suffix, subject_personal_1.first_name AS subject_personal_1_first_name, subject_personal_1.last_name AS subject_personal_1_last_name, subject_personal_1.identification_number AS subject_personal_1_identification_number, subject_personal_1.birth_date AS subject_personal_1_birth_date, subject_personal_1.mobile_personal AS subject_personal_1_mobile_personal, subject_personal_1.phone_personal AS subject_personal_1_phone_personal, subject_personal_1.phone_home AS
Re: [sqlalchemy] sqlalchemy postgresql error
On Thu, Sep 26, 2013 at 11:09 AM, wrote: > windows 7 64bit, flask, sqlalchemy 0.8.2, postgresql latest > > Traceback (most recent call last): > File "E:/code/python/sqlalchemy-test/sql-test.py", line 30, in > db.session.add(admin) > File "build\bdist.win-amd64\egg\sqlalchemy\orm\scoping.py", line 149, in > do > File "build\bdist.win-amd64\egg\sqlalchemy\util\_collections.py", line > 852, in __call__ > File > "D:\Python27\lib\site-packages\flask_sqlalchemy-1.0-py2.7.egg\flask_sqlalchemy\__init__.py", > line 139, in __init__ > bind=db.engine, > File > "D:\Python27\lib\site-packages\flask_sqlalchemy-1.0-py2.7.egg\flask_sqlalchemy\__init__.py", > line 780, in engine > return self.get_engine(self.get_app()) > File > "D:\Python27\lib\site-packages\flask_sqlalchemy-1.0-py2.7.egg\flask_sqlalchemy\__init__.py", > line 797, in get_engine > return connector.get_engine() > File > "D:\Python27\lib\site-packages\flask_sqlalchemy-1.0-py2.7.egg\flask_sqlalchemy\__init__.py", > line 473, in get_engine > self._engine = rv = sqlalchemy.create_engine(info, **options) > File "build\bdist.win-amd64\egg\sqlalchemy\engine\__init__.py", line 332, > in create_engine > File "build\bdist.win-amd64\egg\sqlalchemy\engine\strategies.py", line 64, > in create > File > "build\bdist.win-amd64\egg\sqlalchemy\dialects\postgresql\psycopg2.py", line > 368, in dbapi > ImportError: No module named psycopg2 > > Process finished with exit code 1 > > > > somebody help me ?? > I hope this isn't a silly question, but have you installed the psycopg2 package (https://pypi.python.org/pypi/psycopg2)? SQLAlchemy doesn't include the low-level database drivers - you have to install the appropriate driver for the database you are using. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
[sqlalchemy] sqlalchemy postgresql error
windows 7 64bit, flask, sqlalchemy 0.8.2, postgresql latest Traceback (most recent call last): File "E:/code/python/sqlalchemy-test/sql-test.py", line 30, in db.session.add(admin) File "build\bdist.win-amd64\egg\sqlalchemy\orm\scoping.py", line 149, in do File "build\bdist.win-amd64\egg\sqlalchemy\util\_collections.py", line 852, in __call__ File "D:\Python27\lib\site-packages\flask_sqlalchemy-1.0-py2.7.egg\flask_sqlalchemy\__init__.py", line 139, in __init__ bind=db.engine, File "D:\Python27\lib\site-packages\flask_sqlalchemy-1.0-py2.7.egg\flask_sqlalchemy\__init__.py", line 780, in engine return self.get_engine(self.get_app()) File "D:\Python27\lib\site-packages\flask_sqlalchemy-1.0-py2.7.egg\flask_sqlalchemy\__init__.py", line 797, in get_engine return connector.get_engine() File "D:\Python27\lib\site-packages\flask_sqlalchemy-1.0-py2.7.egg\flask_sqlalchemy\__init__.py", line 473, in get_engine self._engine = rv = sqlalchemy.create_engine(info, **options) File "build\bdist.win-amd64\egg\sqlalchemy\engine\__init__.py", line 332, in create_engine File "build\bdist.win-amd64\egg\sqlalchemy\engine\strategies.py", line 64, in create File "build\bdist.win-amd64\egg\sqlalchemy\dialects\postgresql\psycopg2.py", line 368, in dbapi ImportError: No module named psycopg2 Process finished with exit code 1 somebody help me ?? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
[sqlalchemy] Re: pymssql connect mssql server
http://stackoverflow.com/questions/7250464/python-and-pymssql https://bugs.launchpad.net/ubuntu/+source/pymssql/+bug/918896 -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
[sqlalchemy] pymssql connect mssql server
hello everyone, i have a problom with pymssql connect mssql server .please help me to sovle it.thx code: connect_str = r"mssql+pymssql://" connect_str += r"%s:%s@%s:%s/%s?charset=%s" % (self.username, self.password, self.ip, self.port, self.db_name, self.get_encode_display()) engine = sqlalchemy.create_engine(db_connect_str) Session = sqlalchemy.orm.sessionmaker(bind=engine) session = Session() data = session.execute(sql_str) backtrack: File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 170, in initialize self._get_server_version_info(connection) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/mssql/pymssql.py", line 72, in _get_server_version_info r"Microsoft SQL Server.*? - (\d+).(\d+).(\d+).(\d+)", vers) File "/usr/lib/python2.7/re.py", line 137, in match return _compile(pattern, flags).match(string) TypeError: expected string or buffer i print vers, it's None. but,i try it in shell, ~$ sqsh -U sa -P 123456 -S 192.168.1.21 1> select @@version 2> go --- Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86) Jul 9 2008 14:43:34 Copyright (c) 1988-2008 Microsoft Corporation Enterprise Evaluation Edition on Windows NT 5.1 (Build 2600: Service Pack 3) (1 row affected) -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.