Title: Bulkcopy: Cannot cast Row object as tuple · Issue #482 · microsoft/mssql-python · GitHub
Open Graph Title: Bulkcopy: Cannot cast Row object as tuple · Issue #482 · microsoft/mssql-python
X Title: Bulkcopy: Cannot cast Row object as tuple · Issue #482 · microsoft/mssql-python
Description: List of Rows from cursor.fetchall() cannot be used directly in bulkcopy Data retrieved using cursor.fetchall() is of type List[Row]. Intuitively I would expect to be able to use these objects directly in cursor.bulkcopy(), but I get an e...
Open Graph Description: List of Rows from cursor.fetchall() cannot be used directly in bulkcopy Data retrieved using cursor.fetchall() is of type List[Row]. Intuitively I would expect to be able to use these objects direc...
X Description: List of Rows from cursor.fetchall() cannot be used directly in bulkcopy Data retrieved using cursor.fetchall() is of type List[Row]. Intuitively I would expect to be able to use these objects direc...
Opengraph URL: https://github.com/microsoft/mssql-python/issues/482
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bulkcopy: Cannot cast Row object as tuple","articleBody":"### List of Rows from cursor.fetchall() cannot be used directly in bulkcopy\n\nData retrieved using `cursor.fetchall()` is of type `List[Row]`. Intuitively I would expect to be able to use these objects directly in `cursor.bulkcopy()`, but I get an exception.\n\n```\n File \"/home/vscode/.local/lib/python3.14/site-packages/mssql_python/cursor.py\", line 2706, in bulkcopy\n raise type(e)(str(e)) from None\nValueError: Expected tuple, got: 'Row' object cannot be cast as 'tuple'\n```\n\n### To reproduce\n\n```python\nimport mssql_python\n\nconn = mssql_python.connect(\"...\")\ncursor = conn.cursor()\n\ncursor.execute(f\"SELECT TOP 10 * FROM table_A\")\ndata = cursor.fetchall()\ncopy_result = cursor.bulkcopy(\"table_B\", data)\n\nconn.close()\n```\n\n(This is a simplified example - in reality I stumpled on this while trying to migrate data between two databases on different servers).\n\n### Expected behavior\nI expected the `bulkcopy` method to accept a data argument of type `List[Row]`.\n\n### Further technical details\nPython version: 3.14\nSQL Server version: Microsoft SQL Azure 12.0.2000.8\nOperating system: Linux 39a7e4bda3b8 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 GNU/Linux","author":{"url":"https://github.com/ebj-jyskebank-dk","@type":"Person","name":"ebj-jyskebank-dk"},"datePublished":"2026-03-23T08:11:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/482/mssql-python/issues/482"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ac4a034b-cc97-0d91-b6fa-c7d53946bb3c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E90C:13DDC4:818C5B7:B5316F2:6A504D2F |
| html-safe-nonce | 5cd2fcf7c9ce6379bb5030569dd3821d8acc882ed0a40eb6c1c4c5a2b2108b53 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTBDOjEzRERDNDo4MThDNUI3OkI1MzE2RjI6NkE1MDREMkYiLCJ2aXNpdG9yX2lkIjoiNTY5OTMwMDk0OTM1NDM2ODMwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 206583993ee64fbd72eab50d1675d029014693553af9093ce5a466eac2ffe387 |
| hovercard-subject-tag | issue:4119050128 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/mssql-python/482/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e1a9c780c45ff5534101975b5bc7b658f5856f9d1a5689c40e72862e1b982119/microsoft/mssql-python/issues/482 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e1a9c780c45ff5534101975b5bc7b658f5856f9d1a5689c40e72862e1b982119/microsoft/mssql-python/issues/482 |
| og:image:alt | List of Rows from cursor.fetchall() cannot be used directly in bulkcopy Data retrieved using cursor.fetchall() is of type List[Row]. Intuitively I would expect to be able to use these objects direc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ebj-jyskebank-dk |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/mssql-python git https://github.com/microsoft/mssql-python.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 921684538 |
| octolytics-dimension-repository_nwo | microsoft/mssql-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 921684538 |
| octolytics-dimension-repository_network_root_nwo | microsoft/mssql-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5741a45fe07e5f377d0d4c524a92e3056acc51bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width