-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
SA 2.0 Invalid Precision Value Error SQLBindParameter with pyodbc #8681
Comments
I would need better information here to be able to act upon this. however the issue is likely due to https://docs.sqlalchemy.org/en/20/changelog/changelog_20.html#change-66bddfbbce3c9e37214e8c5864ab1fad . steps to take:
e = create_engine("mssql+pyodbc://...", use_setinputsizes=False)
|
oh additionally, it looks like your message is identical to what we just fixed at #8661. so it might be that simple, please run the latest github main of SQLAlchemy to confirm that fixes this issue. |
@zzzeek Thank you for the quick response. I can confirm setting For your reference, that CREATE TABLE [dbo].[products12](
[id] [bigint] NOT NULL,
[created_at] [datetime] NOT NULL,
[updated_at] [datetime] NOT NULL,
[title] [nvarchar](255) NULL,
[body_html] [nvarchar](max) NULL,
[vendor] [nvarchar](255) NULL,
[product_type] [nvarchar](255) NULL,
[handle] [nvarchar](255) NULL,
[published_at] [datetime] NULL,
[template_suffix] [nvarchar](255) NULL,
[status] [nvarchar](255) NULL,
[published_scope] [nvarchar](255) NULL,
[tags] [nvarchar](max) NULL,
[admin_graphql_api_id] [nvarchar](255) NULL,
[image_src] [nvarchar](255) NULL,
CONSTRAINT [PK_product65s] PRIMARY KEY CLUSTERED
(
[id] ASC
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO The only numerical column is the bigint, the rest are all unicode text based. The largest column is |
Describe the bug
When upgrading to SQLAlchemy 2.0.0b1 I receive the following error message with PYODBC version 18 with Microsoft SQL Server 2019. This error does not occur with SA 1.4 and does not occur with MySQL using mysqlclient. Tested with python 3.9 and 3.10 on Ubuntu 20.04 in a Docker Container. The SQL Server and python package are running in the same container, but I've tested it on a separate container running Ubuntu 20.04 as well.
Error Message:
To Reproduce
This occurs when I reflect a database table, create a new temporary table based on the column names and types and then insert the data after being serialized from a DataFrame.
The error occurs in the
conn.execute(tmp.insert(), tbl_data)
step in thesql_merge()
method. I've eliminated some of the unrelated code:The table that is being reflected is based on this model but I do not copy the primary key to the new table, only the column name and type:
Error
Versions
Additional context
No response
The text was updated successfully, but these errors were encountered: