Thanks heaps for your comments, manage to get it work using the as_dict`
parameter of the `cursor` object,
cus=conn.cursor(as_dict=True)
cus.execute("SELECT budget_code,budget_description,rate_type FROM glbud")
for row in cus:
print(row['budget_code'],row['budget_description'],row['rate_type']
> for row in cus:
>print(row.budget_code)
>
>
> NameError: name 'budget_code' is not defined
You'll need to use a DictCursor to be able to access rows by name and not
position (which IMO is the preferred way).
cus = conn.cursor(pymysql.cursors.DictCursor)
cus.execute("SELECT * FROM
ok did some changes:
conn=pymssql.connect(server,username,password,database)
cus=conn.cursor(
cus.execute("SELECT budget_code,budget_description,rate_type FROM glbud")
for row in cus:
print(row)
the above code display the selected column
but when i iterate and try to print the fields, its
On Friday, September 9, 2016 at 12:48:50 PM UTC+12, sum abiut wrote:
> cus.execute("SELECT * FROM glbud ")
Never use “select *”, except for testing.
> for row in cus:
>print(row)
> this works perfect, but when i try to iterate through and only print out
> specific fields i got
Hi,
i have used pymssql to connet to windows database but i want to be able
iterate and only print out some specific fields.
here is what i did
conn=pymssql.connect(server,username,password,database)
cus=conn.cursor()
cus.execute("SELECT * FROM glbud ")
for
nstalled following modules & softwares in python 2.7 :
>
> python 2.7.2
> setuptools
> MySQLdb Module
> pymssql module
> yum install mysql msql-devel freetdf
>
> I have installed freetds 0.9version. After installation of all the
> above components, I have done fo
QLdb Module
pymssql module
yum install mysql msql-devel freetdf
I have installed freetds 0.9version. After installation of all the above
components, I have done following things
Python 2.6 (r26:66714, Apr 8 2010, 08:46:35)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help&quo
On Monday 23 August 2010, it occurred to f1crazed to exclaim:
> Hello,
>
> I am new to the python world. I'm trying the install the pymssql
> package and have been unsuccessful. I am running Win7 x64. Here is
> the output I get when I try to build the pymssql package:
Hello,
I am new to the python world. I'm trying the install the pymssql
package and have been unsuccessful. I am running Win7 x64. Here is
the output I get when I try to build the pymssql package:
running build
running build_ext
cythoning _mssql.pyx to _mssql.c
building '_mssql&
Hi everyone, I'm trying to build an executable with py2exe. My script
uses SQLalchemy and pymssql with python 2.6. Here is my setup file:
from distutils.core import setup
import py2exe
manifest = """
myProgram
"""
On Mar 12, 3:36 pm, a...@pythoncraft.com (Aahz) wrote:
> [posted and e-mailed, please reply to group]
>
> In article <851ed9db-2561-48ad-b54c-95f96a7fa...@q9g2000yqc.googlegroups.com>,
> marcwyburn wrote:
>
> >Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the
> >follwoing error
[posted and e-mailed, please reply to group]
In article <851ed9db-2561-48ad-b54c-95f96a7fa...@q9g2000yqc.googlegroups.com>,
marc wyburn wrote:
>Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the
>follwoing error.
>
>(, OperationalError("SQL Server
>message 102, severity 15, st
taking place hence the string is
being read but I can work out whether I need to character encode in
Python, change a table setting in SQL or do something to pymssql.
Thanks, Marc.
--
http://mail.python.org/mailman/listinfo/python-list
Hi!
Look at http://www.mayukhbose.com/python/ado/ado-connection.php
That run OK with Python 2.6
@-salutations
--
MCI
--
http://mail.python.org/mailman/listinfo/python-list
when would pymssql come out with a release that is compatible with
python 2.6 ?
Thanks
-TK
--
http://mail.python.org/mailman/listinfo/python-list
>> sql = "select * from table_1"
> >>> cur.execute(sql)
> >>> cur.fetchall()
> [('\xc2\xa3',), ('1',)]
>
> If I insert a £ symbol in using SQL management studio then select it back
> from Python I get this:
>
> [(
; >>> sql = "select * from table_1"
> >>> cur.execute(sql)
> >>> cur.fetchall()
>
> [('\xc2\xa3',), ('1',)]
>
> If I insert a £ symbol in using SQL management studio then select it back
> from Python I get this:
&g
in stone, I can't do anything with it. I'm
> currently opening autogenerated SQL scripts, decoding them from utf-16
> and then back into utf-8 for pymssql to run them.
>
> It's been working great for ages until someone noticed the £ symbols had
> this extra character
for the help. Unfortunately pyodbc seems to only work on Windows.
I need to connect to the SQL server from a Linux box.
The db schema is very set in stone, I can't do anything with it. I'm
currently opening autogenerated SQL scripts, decoding them from utf-16
and then back into utf-8 for pyms
>>> sql = "select * from table_1"
> >>> cur.execute(sql)
> >>> cur.fetchall()
> [('\xc2\xa3',), ('1',)]
>
> If I insert a £ symbol in using SQL management studio then select it back
> from Python I get this:
>
> [('
TE TABLE b (x NVARCHAR (1))")
db.execute ("INSERT INTO b (x) VALUES (?)", ['£'])
db.execute ("INSERT INTO b (x) VALUES (?)", [u'£'])
db.execute ("COMMIT")
for x, in db.execute ("SELECT x FROM b"):
print repr (x), unicodedata.name (x[0])
[*
If I insert a £ symbol in using SQL management studio then select it back from
Python I get this:
[('\xc2\xa3',), ('1',), ('\xa3',)]
If I look in SQL management studio it says this:
£
for the inserts I do through Python/pymssql.
Does anyone have any ideas whats happening and how to fix it?
Thanks
--
Darren Mansell <[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 21 Oct 2008 20:44:24 +0200, Mike Hansen <[EMAIL PROTECTED]>
wrote:
Hi,
I saw your posting on the python list about pymssql and you mentioned
that you call stored procedures and get back output parameters. Are you
doing this on Windows or Linux? I can't seem to get it
Aspersieman wrote:
[... re output params in pymssql / pyodbc ...]
Oh, trust me - I've tried a *LOT*. I aggree, submitting a feature
request is a good idea. I think I'll do that. :)
Looks like someone already has:
http://sourceforge.net/tracker/index.php?func=detail&aid=19
On Tue, 21 Oct 2008 13:06:37 +0200, Tim Golden <[EMAIL PROTECTED]>
wrote:
Aspersieman wrote:
However, pyODBC doesn't support return variables(parameters) in stored
procedures (at least with MS SQL). pymssql is the only db api for
python that I've found that can reliab
Aspersieman wrote:
However, pyODBC doesn't support return variables(parameters) in stored
procedures (at least with MS SQL). pymssql is the only db api for python
that I've found that can reliably do this. I've tried adodbapi, pyodbc
and one or two others (can't th
On Tue, 21 Oct 2008 10:14:56 +0200, ChaosKCW <[EMAIL PROTECTED]> wrote:
On Oct 20, 3:38 pm, Tim Golden <[EMAIL PROTECTED]> wrote:
Eric Wertman wrote:
>> I am trying to use pymssql, and have an issue where by the execute
>> (not the fetch) is appearing to load all recor
On Oct 20, 3:38 pm, Tim Golden <[EMAIL PROTECTED]> wrote:
> Eric Wertman wrote:
> >> I am trying to use pymssql, and have an issue where by the execute
> >> (not the fetch) is appearing to load all records into memory.
>
> >> if I execute
>
> >&g
Eric Wertman wrote:
I am trying to use pymssql, and have an issue where by the execute
(not the fetch) is appearing to load all records into memory.
if I execute
con = pymssql.connect(...)
cur = con.cursor()
cur.execute(sql)
rec = cur.fetchone()
if I put in a query which returns a lot of
> I am trying to use pymssql, and have an issue where by the execute
> (not the fetch) is appearing to load all records into memory.
>
> if I execute
>
> con = pymssql.connect(...)
> cur = con.cursor()
> cur.execute(sql)
> rec = cur.fetchone()
>
> if I put
Hi
I am trying to use pymssql, and have an issue where by the execute
(not the fetch) is appearing to load all records into memory.
if I execute
con = pymssql.connect(...)
cur = con.cursor()
cur.execute(sql)
rec = cur.fetchone()
if I put in a query which returns a lot of records into &quo
[EMAIL PROTECTED] wrote:
> On 10月17日, 下午6时41分, Peter Otten <[EMAIL PROTECTED]> wrote:
>> [EMAIL PROTECTED] wrote:
>> > the code is below:
>> > import pymssql
>> > conn = pymssql.connect(host = "121.198.126.233",user = "",password
&
On 10月17日, 下午6时41分, Peter Otten <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > the code is below:
> > import pymssql
> > conn = pymssql.connect(host = "121.198.126.233",user = "",password
> > = "",database =
On 10月17日, 下午6时41分, Peter Otten <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > the code is below:
> > import pymssql
> > conn = pymssql.connect(host = "121.198.126.233",user = "",password
> > = "",database =
[EMAIL PROTECTED] wrote:
> the code is below:
> import pymssql
> conn = pymssql.connect(host = "121.198.126.233",user = "",password
> = "",database = "test")
> print "connecting success"
> cursor = conn.cursor()
> cu
the code is below:
import pymssql
conn = pymssql.connect(host = "121.198.126.233",user = "",password
= "",database = "test")
print "connecting success"
cursor = conn.cursor()
cursor.execute("insert into bbs_test values(%s,%s,%s,
Fredrik Lundh wrote:
reading the documentation might help:
http://pymssql.sourceforge.net/troubleshooting.html#dbid
also see the SQL server reference documentation (the section "Rules for
Regular Identifiers" describes the valid syntax):
http://msdn.microsoft.com/en-us/library/ms17
Samuel Morhaim wrote:
I believe there is a bug in Python.. _mssql ...I am not too familiar
with Python yet, but after adding several breakpoints and watching the
variable, the last step of pymssql.py is
# open the connection
con = _mssql.connect(dbhost, dbuser, dbpasswd)
con
;
> please help... thanks.
>
>
>
> On Wed, Aug 13, 2008 at 4:54 PM, Samuel Morhaim <[EMAIL PROTECTED]>wrote:
>
>> I tried:
>>
>> import sys
>> import pymssql
>>
>> db = 'Gcare4UI-B6_3_dev'
>>
>> conn = pymssql.connec
(of
course because the DB without the - doesnt exist... )
please help... thanks.
On Wed, Aug 13, 2008 at 4:54 PM, Samuel Morhaim <[EMAIL PROTECTED]>wrote:
> I tried:
>
> import sys
> import pymssql
>
> db = 'Gcare4UI-B6_3_dev'
>
> conn = pymssql.conne
I tried:
import sys
import pymssql
db = 'Gcare4UI-B6_3_dev'
conn = pymssql.connect (host = "localhost",
user = "myname",
password = "mypassword",
database = db)
And this return
-On [20080414 10:31], James Su ([EMAIL PROTECTED]) wrote:
>But when I query those data by pymssql or pyodbc, all Chinese
>Character display ??? instead.
Sounds like you are getting typical Unicode replacement characters.
--
Jeroen Ruigrok van der Werven / asmodai
イェルーン ラウフロック ヴァン デル
I tried to use pymssql to access MSSQL 2000, with a table, I store
Chinese Character in NVarchar field, Chinese Character display
normally when I query them by MS SQL Query Analyzer under Windows or
by unixODBC under Ubuntu.
But when I query those data by pymssql or pyodbc, all Chinese
Character
Tzury Bar Yochay wrote in news:3a6c32fe-e7c1-4230-882d-efb3415196c1
@b1g2000hsg.googlegroups.com in comp.lang.python:
> for example:
> the value
> 'EE604EE3-4AB0-4EE7-AF4D-018124393CD7'
> is represent as
> '\xe3N`\xee\xb0J\xe7N\xafM\x01\x81$9<\xd7'
>
from uuid import *
u = UUID( bytes = '\xe3N`
These are not cut&paste but typed by hand, yet they are identical to
the actual output.
seems like the first 8 bytes are swapped while the other half is
straightforward.
I deeply thank you for your assistance.
I am currently using a combination of reversed and list comprehension
to rebuild this b
hi,
in my table the field row_id is type of uniqueidentifier.
when try to fetch the data, pymssql somehow, encodes the values in a
way which yields odd results.
for example:
the value
'EE604EE3-4AB0-4EE7-AF4D-018124393CD7'
is represent as
'\xe3N`\xee\xb0J\xe7N\xafM\x01\x81$9<\
at it is a rookie mistake. Below is
> a test I came up with to prove this. I am on Windows XP using Python 2.5
> and pymssql-0.8.0-py2.5.
>
> CREATE TABLE [dbo].[Test](
> [test] [varchar](50) NULL,
> [inttest] [int] NULL
> ) ON [PRIMARY]
>
> 1.
> import pymss
I also forgot to mention that this...
import pymssql
TestDB =
pymssql.connect(host='Test',user='test',password='test',database='test')
cursor = TestDB.cursor()
query = """INSERT INTO test.dbo.test (test) VALUES ('%s');"&qu
came up with to prove this. I am on Windows XP using Python 2.5
and pymssql-0.8.0-py2.5.
CREATE TABLE [dbo].[Test](
[test] [varchar](50) NULL,
[inttest] [int] NULL
) ON [PRIMARY]
1.
import pymssql
TestDB =
pymssql.connect(host='Test',user='test',password='
params. One of the values in the params is a NULL value going to int
>> > field. The pymssql._quote() puts ' around the NULL which causes an
>> > exception to be thrown, is there a way to use the params for this or
>> > do I need to build the insert string myself?
params is a NULL value going to int
> > field. The pymssql._quote() puts ' around the NULL which causes an
> > exception to be thrown, is there a way to use the params for this or
> > do I need to build the insert string myself?
>
> > pymssql.DatabaseEr
rc wrote:
> How to insert NULL values in to int field using params.
>
> I'm trying to use pymssql.execute, passing the operation and list of
> params. One of the values in the params is a NULL value going to int
> field. The pymssql._quote() puts ' around the NULL wh
How to insert NULL values in to int field using params.
I'm trying to use pymssql.execute, passing the operation and list of
params. One of the values in the params is a NULL value going to int
field. The pymssql._quote() puts ' around the NULL which causes an
exception to be thrown,
[EMAIL PROTECTED] wrote:
> Hi,
>
> I'm trying to use pymssql to execute a stored procedure. Currently, I
> have an Excel spreadsheet that uses VBA in this manner:
>
> Private Function CreateNewParrot(connDb As ADODB.Connection) As Long
> Dim objCommand As ADODB.Comma
Hi,
I'm trying to use pymssql to execute a stored procedure. Currently, I
have an Excel spreadsheet that uses VBA in this manner:
Private Function CreateNewParrot(connDb As ADODB.Connection) As Long
Dim objCommand As ADODB.Command
Dim iParrot As Long
Dim bSuccess As Boolean
Hello, I'm using pymssql to extract data from a legacy table with a non-ascii encoded name. The strange thing is that I can make my query from the idle's console, but it doesn't work from python. (I'm working in a windows environment)
The error shows that there's a proble
[EMAIL PROTECTED] wrote:
> hi
> i am using pymmsql to query a date column in MSSQL database table.
> However the result shows for example
> (datetime.datetime(2006, 2, 16, 17, 50, 19) which is supposed to be
> 2006-02-16 17:50:19.000
> anyway to correct query a date column using
hi
i am using pymmsql to query a date column in MSSQL database table.
However the result shows for example
(datetime.datetime(2006, 2, 16, 17, 50, 19) which is supposed to be
2006-02-16 17:50:19.000
anyway to correct query a date column using pymssql so that it gives
the correct date format
> (to email use "boris at batiment71 dot ch")
oops, that's "boris at batiment71 dot net"
--
http://mail.python.org/mailman/listinfo/python-list
I have a strange problem : some code that fetches queries from an mssql
database works fine under Idle but the very same code run from a shell
window obtains its strings garbled as if the encoding codepage was
modified. This occurs only when using pymssql to connect; if I connect
through odbc
I need to write a little app that connects to an MS SQL
server and for this I decided on the pymssql module. At this stage I am trying
to find out if MS SQL server can handle bind variables. If anybody can give me
an answer and perhaps a example it will be appreciated
Thanks
Albert
I have a query that is running on a mssql DB that takes about 15
minutes when run "directly"; IE: thru MS SQL Query Analyzer. I know, it
sucks. I'm trying to fix it.
But in the meantime, I have a python process which connects to the DB
using pymssql. This process runs the afor
62 matches
Mail list logo