Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text truncated with Filemaker #956

Closed
sebastianelsner opened this issue Sep 16, 2021 · 4 comments
Closed

text truncated with Filemaker #956

sebastianelsner opened this issue Sep 16, 2021 · 4 comments

Comments

@sebastianelsner
Copy link

Environment

To diagnose, we usually need to know the following, including version numbers. On Windows, be
sure to specify 32-bit Python or 64-bit:

  • Python: 3.9.6
  • pyodbc: 4.0.32
  • OS: Windows 10
  • DB: Filemaker 12
  • driver: Filemaker ODBC

Issue

Hello!

I am connecting to a filemaker odbc data source like so:

import pyodbc
connection = pyodbc.connect("DSN=cura;UID=admin;PWD=123)
cursor = connection.cursor()
for row in cursor.execute("SELECT id, textcol FROM table"):
    print(row)

It appears the textcol data is truncated to 2047 cutting text off mid-word.

I found this ticket #835 which mentions the same "limit", but I cannot make much of it.

I have checked the driver's docs and settings, it has a toggle for "Describe text fields as long varchar". But it does not change behaviour.

I tested with the pywin32 odbc module and it returns the correct text, so I assume this is an issue in pyodbc since pywin32.odbc works with the same data source.

Maybe you have a pointer what I could check to debug?

Thank you!

@gordthompson
Copy link
Collaborator

Please generate an ODBC trace log and upload it as an attachment to a comment.

@sebastianelsner
Copy link
Author

Thanks! I have created one.

I guess the relevant part is:

flask           d40-310	EXIT  SQLGetData  with return code 1 (SQL_SUCCESS_WITH_INFO)
		HSTMT               0x00000272224CB3B0
		UWORD                        2 
		SWORD                       -8 <SQL_C_WCHAR>
		PTR                 0x0000027225C77CA0 [    4096] ""
		SQLLEN                  4096
		SQLLEN *            0x000000C6B03EB8D0 (4640)

		DIAG [01004] [FileMaker][FileMaker] String data, right-truncated (0) 

I have attached the full log of one query: SQL.LOG

@v-chojas
Copy link
Contributor

Driver bug. pyODBC sees the truncation and makes another call to SQLGetData to retrieve the next block of 4k, but the driver returns no more data.

https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function#retrieving-variable-length-data-in-parts

@sebastianelsner
Copy link
Author

Hm, I now tested with a newer driver from a Filemaker version, which is not supposed to be compatible (thats why I did not test tat before).... Now I get the whole text. Seems to work! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants