f



sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]'f2f68'

=======================case1==============================:
import sqlalchemy 
test1 = "631f2f68-8731-4561-889b-88ab1ae7c95a"
cmdTest1 = "select * from analyseresult where uid = " + test1
engine = sqlalchemy.create_engine("mssql+pyodbc://DumpResult:123456@localhost/DumpResult")
c = engine.execute(cmdTest1)
======================case2===============================:
import sqlalchemy 
test2 = "123"
cmdTest2 = "select * from analyseresult where uid = " + test2
engine = sqlalchemy.create_engine("mssql+pyodbc://DumpResult:123456@localhost/DumpResult")
c = engine.execute(cmdTest1)


!!!!!
case1 :wrong,(sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]'f2f68') case2:work!
0
xs.nepaul (9)
8/17/2012 9:56:07 AM
comp.lang.python 77058 articles. 6 followers. Post Follow

2 Replies
4714 Views

Similar Articles

[PageSpeed] 46

nepaul <xs.nepaul@gmail.com> writes:

> =======================case1==============================:
> import sqlalchemy 
> test1 = "631f2f68-8731-4561-889b-88ab1ae7c95a"
> cmdTest1 = "select * from analyseresult where uid = " + test1
> engine = sqlalchemy.create_engine("mssql+pyodbc://DumpResult:123456@localhost/DumpResult")
> c = engine.execute(cmdTest1)
> ======================case2===============================:
> import sqlalchemy 
> test2 = "123"
> cmdTest2 = "select * from analyseresult where uid = " + test2
> engine = sqlalchemy.create_engine("mssql+pyodbc://DumpResult:123456@localhost/DumpResult")
> c = engine.execute(cmdTest1)
>
>
> !!!!!
> case1 :wrong,(sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]'f2f68') case2:work!

Print both cmdTest1 and cmdTest2. Look at them. Are they valid SQL
queries?

-- Alain.
0
alain14 (278)
8/17/2012 10:54:21 AM
nepaul wrote:

> =======================case1==============================:
> import sqlalchemy
> test1 = "631f2f68-8731-4561-889b-88ab1ae7c95a"
> cmdTest1 = "select * from analyseresult where uid = " + test1
> engine =
> 
sqlalchemy.create_engine("mssql+pyodbc://DumpResult:123456@localhost/DumpResult")
> c = engine.execute(cmdTest1)
> ======================case2===============================: import
> sqlalchemy test2 = "123"
> cmdTest2 = "select * from analyseresult where uid = " + test2
> engine =
> 
sqlalchemy.create_engine("mssql+pyodbc://DumpResult:123456@localhost/DumpResult")
> c = engine.execute(cmdTest1)
> 
> 
> !!!!!
> case1 :wrong,(sqlalchemy.exc.ProgrammingError: (ProgrammingError)
> ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]'f2f68')
> case2:work!

I'd guess the uuid needs to be quoted. Don't do that yourself -- your code 
will become vulnerable to sql injection attacks -- use the dbapi instead:

# Again just guessing; I'm not an sqlalchemy user.
import sqlalchemy 
test1 = "631f2f68-8731-4561-889b-88ab1ae7c95a"
cmdTest1 = "select * from analyseresult where uid = %s"
engine = sqlalchemy.create_engine(
    "mssql+pyodbc://DumpResult:123456@localhost/DumpResult")
c = engine.execute(cmdTest1, test1)

Note that I'm not using Python's string formatting. The two arguments are 
passed as is and mysql builds the resulting query.

0
__peter__ (4031)
8/17/2012 11:04:39 AM
Reply:

Similar Artilces:

Entreprise Manager error message: "[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '#####'. The user is not associated with a trusted SQL Server connection.(28000,18452)"
Can anyone give a quick description of the meaning of this message and what needs to be done to get a connection. I'm running DBArtisan with SQLServer 2000 client SP4 installed. I also get the same message with MS Enterprise Manager so this is coming out of the actual ODBC connection attempt. Thanks in advance! In the future, please do not put part of your message in the subject line. Makes it harder to read. In any case, you're trying to do integrated login and don't have that login set up in the DB. You need to add that login, or change to a SQL Login. -- Greg Moore SQL...

ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')' at
from BeautifulSoup import BeautifulSoup import re, urllib2, MySQLdb #MySQLdb.escape_string(" ") import sys import unicodedata if __name__=="__main__": #link = raw_input("Enter the url link: ") db = MySQLdb.connect("localhost","root","", "ebay") cursor=db.cursor() link = "http://www.ebay.com/sch/Mens-Shoes-/93427/i.html?_pppn=r1&_dcat=93427&LH_ItemCondition=1000%7C1500" link1 =db.escape_string(link) page = urllib2.urlopen(link) soup = BeautifulSoup(page) ...

keep gettting errors using Sequel ODBC::Error: 37000 (170) [Microsoft][ODBC SQL Server Driv er][SQL Server]Line 1: Incorrect syntax near '1'.
i am trying to connect to MSSQL server from xP i have the following problem for any sql. pl help ODBC::Error: 37000 (170) [Microsoft][ODBC SQL Server Driv er][SQL Server]Line 1: Incorrect syntax near '1'. D:\Documents and Settings\>irb irb(main):001:0> require 'odbc' => true irb(main):002:0> require 'Sequel' => true <c('LPM', :user=>'resum', :password=>'ms_0416') => #<Sequel::ODBC::Database: "odbc:resum:ms_04166@/LPM"> irb(main):004:0> require 'rubygems' => false irb(main):005:0> a...

'^=' and '~='?
Hello, What is the difference between '^=' and '~='? Thanks, Duckhye ...

'is not' or '!='
A newbie question to you; what is the difference between statements like: if x is not None: and if x != None: Without any context, which one should be preferred? IMHO, the latter is more readable. On 2014-08-18 21:35, ElChino wrote: > A newbie question to you; what is the difference between statements > like: > if x is not None: > and > if x != None: > > Without any context, which one should be preferred? > IMHO, the latter is more readable. > "x == y" tells you whether x and y refer to objects that are equal. "x is y&qu...

'''''''''''''The Running Update/Append Queries Using VBA code Ordeal''''''''''''''
Hello fellow programmers, I am trying to run an append/update query from code, a command button on a form initiates the queries. the format i am using is; _____________________________________________________ SELECT "criteria" FROM "criteria" WHERE "criteria" UPDATE/APPEND "field selections" RecordSource "qryExample" = above text strings" _______________________________________________________________________ When i am running a SELECT query in this manner it works fine with no problems, and accepts the values of specified linked for...

'''''''''''''The Running Update/Append Queries Using VBA code Ordeal'''''''''''''' #2
Hi, Thanks for ur help there HJ. I know how to do the tasks you specified there. I would like for the update query to use field values from some of the fields on the form (frmInvoices) such as InvoiceNumber, DateFrom, DateTo. My problem is that an append/update query can't find the values in the open Form (frmInvoices) when I specify them as; [Forms]![frmInvoices]![InvoiceNumber] a select query has no problem finding the field values on a form. please help. Aaron Hi Aaron, Could you post the entire code that you are having trouble with? Now it is not possible to see what goes wron...

if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.') Any shorter ?
Hi, there. =20 I'm just curious if it ever dawned on anybody how to abbreviate this line : if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.')=20 =20 Igor Kurbeko Clinical Programmer Analyst 678 336 4328 ikurbeko@atherogenics.com =20 no brain no pain =20 how about: if not (str_mo in ('','.') or str_da in ('','.') or str_yy in ('','.')) OR if not (missing(str_mo) or missing(str_da) or missing(str_yy)) Eric On 22 Oct 03 21:13:37 GMT, ikurbeko@ATHER...

Pro's and Con's of SQL Server 2005 vs. SQL Server 2008
We were just informed that we have to use SQL Server (Enterprise Edition) for our projectinstead of Oracle .. Which version 2005 or 2008 do you suggest is best for stability, features, performance, memory utilization, customization, etc. Also any suggested books, websites, utilities would be appreciated also Sincerely George Lewycky NYCT New York City "George Lewycky" <gelewyc@nyct.com> wrote in message news:3547fa4c-754a-4909-bc92-9b7ed78f5ae9@g6g2000vbr.googlegroups.com... > We were just informed that we have to use SQL Server (Enterprise > Edition) for our proje...

A function with 'and' , 'not' , 'null' , 'car' and 'cdr'
What's this ? (defun enigma (x) (and (not (null x)) (or (null (car x)) (enigma (cdr x))))) "I suppose I should learn Lisp, but it seems so foreign." - Paul Graham, Nov 1983 On Wed, Oct 07 2015, CAI GENGYANG wrote: > What's this ? > > > (defun enigma (x) > (and (not (null x)) > (or (null (car x)) > (enigma (cdr x))))) Bad taste? It returns T if the list X contains nil as an element. It would be clearer to write (some #'null x). Helmut CAI GENGYANG ...

which is more 'pythonic' / 'better' ?
hi, there are 2 versions of a simple code. which is preferred? === if len(line) >= (n+1): text = line[n] else: text = 'nothing' === === try: text = line[n] except IndexError: text = 'nothing' === which is the one you would use? thanks, gabor gabor wrote: > hi, > > there are 2 versions of a simple code. > which is preferred? > > > === > if len(line) >= (n+1): > text = line[n] > else: > text = 'nothing' > === > > > === > try: > text = line[n] > except IndexError: > text = '...

Re: if str_mo not in ('','.') and str_da not in ('','.') and str_yy not in ('','.') Any shorter ?
OR you could use ARRAY data new; set old; array igor $ (*) str_mo str_da str_yr; do over igor; if igor ~in (' ','.') then do; end; run; Prasad Ravi Igor Kurbeko <ikurbeko@ATHEROGENIC To: SAS-L@LISTSERV.UGA.EDU S.COM> cc: Sent by: "SAS(r) Subject: if str_mo not in ('','.') and str_da not in ('','.') and str_yy ...

sql standard: \' or ''
I heard that the sql standard for escaping quotes is '', and not \'. Is this true? BTW, PHP's pg_escape_string returns \' and not ''. __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings CSN wrote: > I heard that the sql standard for escaping quotes is > '', and not \'. Is this true? &...

error: expected '=', ',', ';', 'asm' or '__attrib
Hi I'm trying to compile an ADC Driver & come acrosss the following error. I've no experience writing drivers before, and hence have no clue how to fix it. Hope someone out there has encountered the problem & suggesst a fix for the same. The Error is I get is : qadc.c: At top level: qadc.c:97: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'qadc_read' make: *** [qadc.o] Error 1 [root@localhost qadc]# ########################################################################### ADC Driver Code ####################...

Web resources about - sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]'f2f68' - comp.lang.python

Resources last updated: 2/11/2016 5:31:09 AM