Hello all,

Is there any algorithm to convert a python tuple to MySql query.

Ex:

('*','name','sliver')

should convert to

select [Pri_Key] from [All Tables] where 'name' = 'sliver';

I have been able to do so ... but my algorithm looks very ugly and have to process everything bit by bit.

The query becomes even more complex when i have nested tuples.


Any Ideas?

hi,
as i got you , i think the better way you can use is :

qry = "select %s from %s where %s" %(name,table,filter)

and then you can create your own method to run sql

-VS

Hello all,

Is there any algorithm to convert a python tuple to MySql query.

Ex:

('*','name','sliver')

should convert to

select [Pri_Key] from [All Tables] where 'name' = 'sliver';

I have been able to do so ... but my algorithm looks very ugly and have to process everything bit by bit.

The query becomes even more complex when i have nested tuples.


Any Ideas?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.