473,503 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQLdb and column names

Hello all,

I am using MySQLdb 1.2.2 and have a question about the construction of
the dictionary keys of a result set.

Here is an example query, from which you may intuit some of the
structure of the tables:

SELECT
shots.*,
users.*,
sequences.*,
jobs.*
FROM
shots
LEFT JOIN
users ON users.id=shots.user_id
INNER JOIN
sequences ON sequences.id=shots.sequence_id
INNER JOIN
jobs AS j ON j.id=sequences.job_id
WHERE
shots.id=%s

1. The 'users' table has a column named 'id', as do all the other
tables.
2. I define my cursor as a 'DictCursor' so that my results are
dictionaries
3. The 'shots' id has the key name of 'id', while all the -other-
'id's have key names of the form: "<TABLE>.id"

I would prefer to have the key names consistent, so that event the
"shots" fields have key names of the form "<TABLE>.id"

Is this possible?

Thanks in advance!

--
Wellington

Jan 30 '08 #1
1 1895
change:
I would prefer to have the key names consistent, so that event the

to:
I would prefer to have the key names consistent, so that *even* the
Jan 30 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1438
by: JZ | last post by:
I cannot execute insert data into TEXT field if that data is bigger than 64KB. :( >>> cursor.execute("INSERT INTO table (field) VALUES(%s) WHERE id=1", myValue) Traceback (most recent call...
21
5215
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>> cursor.execute("SELECT * FROM mytest where address = %s",string1) All...
4
2416
by: Lajos Kuljo | last post by:
Hallo, ich bin voll neu im Python-Programming, deshalb ist mein Problem wahrscheinlich trivial: Wenn ich die Script #########################################33 #! /usr/bin/env python import...
2
5784
by: Damjan | last post by:
Does MySQLdb automatically reconnect if the connection to the database is broken? I'm asking this since I have a longrunning Python precess that is connected to Mysql-4.1.11, and I execute "set...
1
7440
by: shearichard | last post by:
Hi - I have written some python to insert a row into a table using MySQLDB. I have never before written SQL/Python using embedded parameters in the SQL and I'm having some difficulties. Could...
2
4064
rhitam30111985
by: rhitam30111985 | last post by:
hi all .. consider the following code: i basically need to build a table in the mysql database with two fields , country and office list... import MySQLdb import sys import os ...
0
1002
by: Frank Aune | last post by:
Hi, Im using a MySQLdb connection with a DictCursor, and to me it seems the wrapping to dictionaries only prepend column names when there is an actual conflict in the keywords. I would like...
2
4302
by: Nikhil | last post by:
I am using the MySQLdb python module. I have a table named 'testing' with few columns, under the 'test' database, what is hosted on a remote mysql server. I want to run the following query to...
3
1124
by: Evan | last post by:
a simple problem but I do not know why...:(, could anyone help me? MySQLdb nominally uses just the %s placeholder style, in my script, i got error if you want to use placeholder(%s) for table...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.