I am writing a sql query where i am getting the key/column name of the SQL query from the user and when i am writing a parameterized query in python then i am getting the key name as $1,$2 instead i want the name of the column.
i have tried this in my python sdk for the cosmos db no sql
queryText ="SELECT @id ,c.source_name,c.field_name FROM c"
item_list = list(container.query_items(query=queryText,parameters=[{"name":'@id','value':'id_name'}],enable_cross_partition_query=True))
and in the output i am getting the value as
[{'$1': 'id_value',
'source_name': 'source_name_value',
'field_name': 'field_name_value'},
.......
]
but i want the '$1' to be replaced by string "id_name" I can't do it in my python to change the name as i have many columns the above code is just to understand the context and i have a huge amount of data getting returned .so changing the data in the script will take a lot of compute. Also string concatentation for the SQL query has a chance of the SQL injection in my application
SELECT @id AS id_name, c.source_name ...