Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to use PostgreSQL extended protocol with ODBC driver executing a parameterized sentence. #117

Open
@omeuid

Description

@omeuid

Hi,

Is there a way to configure the ODBC driver to use the extended protocol when running a parameterized query?

Let's assume the following Python client.

import pyodbc

def connect_to_odbc(uri):
conn = pyodbc.connect(uri)
return conn

def execute_query(conn, query):
cursor = conn.cursor()
cursor.execute(query, 1)
result = cursor.fetchall()
return result

uri = 'DSN=MyDSN'

conn = connect_to_odbc(uri)
query = 'SELECT * from mytable where id = ?'

result = execute_query(conn, query)

for row in result:
print(row)

conn.close()

If the DSN is configured with 'server side prepare' option set to 1 (and also batch size is set to 1):

  • I expected that the driver would send P/B/E messages.
  • However, what I'm observing is that the driver only sends a Q message, with the parameter already replaced.

Could you confirm if this is the expected behaviour?

Is there anything that I can configure in the driver in order to get the behaviour that I was expecting?

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp