Skip to content

[PG DRIVER] params are not working for cypher (and probably others languages others than SQL) #2119

Description

@ExtReMLapin

Title, test code :

import psycopg

db_string_test = 'TEST'

with psycopg.connect(user="root", password="rootroot",
                    host='localhost',
                    port='5432',
                    dbname=db_string_test,
                    sslmode='disable'
                    ) as connection:
    
    connection.autocommit = True

    with connection.cursor(row_factory=psycopg.rows.dict_row) as cursor:
        params = {'select_value': 4}
        query = "SELECT %(select_value)s"
        cursor.execute(query, params)
        result = cursor.fetchall()
        print(result)
    print('sql param works')


    with connection.cursor(row_factory=psycopg.rows.dict_row) as cursor:
        
        query = '{cypher}return $ret_value'
        cursor.execute(query, {'ret_value':1})
        ret = cursor.fetchall()
        print(ret)

    print('cypher param works')

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions