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
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
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
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=1985956&group_id=162557
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 reliably do this. I've tried
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 think of the names now... :-/).
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 records into memory.
>> if I e
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
>
> >> con = pymssql.connect(...)
> >> cur = con.cursor()
>
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 reco
> 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
rc wrote:
> On Oct 17, 11:07 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
>> 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
On Oct 17, 11:07 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> 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.
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 which causes an
> exception to
[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.Command
> Dim iParrot As Long
>
[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 pymssql so that it
19 matches
Mail list logo