-
Notifications
You must be signed in to change notification settings - Fork 562
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Clipping Command #1310
Comments
using a larger file causes the issue small file works fine |
|
How large does the file have to be before you start to have problems? |
The version that you mentioned is the only one that I am using already, It
works with a dot net program so I see its the limitation of PYODBC library
that it is clipping off even the command part.
[image: image.png]
*Regards,*
*Harsh Parekh*
…On Fri, 8 Dec 2023 at 01:43, v-chojas ***@***.***> wrote:
SQL Server is the old driver that comes with Windows and only supports a
subset of current SQL features. According to the driver version you
mentioned, try using Driver=ODBC Driver 17 for SQL Server instead.
—
Reply to this email directly, view it on GitHub
<#1310 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJUXQJR2BWTDWP4QEOJP25TYIHPZFAVCNFSM6AAAAABAKQACPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBVGU3TQNZWG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Not sure exactly. however it worked with a 2kB file and didnt with a 150kB file |
This proof-of-concept code shows that there is no such "length limitation in [a pyodbc] cursor", or at least not nearly as low as you report (150kb). import pyodbc
cnxn = pyodbc.connect(
"Driver=ODBC Driver 17 for SQL Server;"
"Server=192.168.0.199;"
"UID=scott;PWD=tiger^5HHH;"
"Database=test;",
autocommit=True,
)
crsr = cnxn.cursor()
crsr.execute("DROP TABLE IF EXISTS my_table")
crsr.execute("CREATE TABLE my_table (id int primary key, att varbinary(max))")
with open("test.pdf", "rb") as f:
attachment_data = f.read()
print(f"attachment_data parameter is {len(attachment_data):,} bytes")
# attachment_data parameter is 8,407,659 bytes
crsr.execute(
"INSERT INTO my_table (id, att) VALUES (?, ?)",
(1, attachment_data),
)
db_len = crsr.execute(
"SELECT LEN(att) FROM my_table WHERE id = 1"
).fetchval()
print(f"number of bytes stored in database: {db_len:,}")
# number of bytes stored in database: 8,407,659 Your problem is either a driver issue or something wrong with your code. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Please first make sure you have looked at:
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:
Issue
I have done some trouble shooting and found that there is a length limitation in cursor I tried the csv and it worked but couldnt upload a PDF.
Code
The text was updated successfully, but these errors were encountered: