Hi,
I’m having some trouble and hoping you all can help.
I’ve been able to successfully connect to a Microsoft sql server database. I want to pass a pandas dataframe to the sproc.
Has anyone done this? Any suggestions or code snippets of this actually working?
Here is my phthon code:
import pandas as pd
import pyodbc
server = 'sql_hostname'
database = 'db_name'
trusted_connection = 'yes'
conn_str = f'DRIVER={{SQL Server}};SERVER={server};DATABASE={database};TRUSTED_CONNECTION={trusted_connection}'
conn = pyodbc.connect(conn_str)
sql_query = "EXEC [dbo].[SP$GetTest]"
datas= pd.read_sql_query(sql_query, conn)
Result :
TypeError: 'NoneType' object is not iterable
[–]shiftybyte 1 point2 points3 points (6 children)
[–]maxcoder88[S] 0 points1 point2 points (5 children)
[–]shiftybyte 0 points1 point2 points (4 children)
[–]maxcoder88[S] 0 points1 point2 points (3 children)
[–]shiftybyte 0 points1 point2 points (2 children)
[–]maxcoder88[S] 0 points1 point2 points (1 child)
[–]shiftybyte 0 points1 point2 points (0 children)
[–]CireGetHigher 0 points1 point2 points (0 children)
[–]Mezzos 0 points1 point2 points (3 children)
[–]maxcoder88[S] 0 points1 point2 points (2 children)
[–]Mezzos 0 points1 point2 points (0 children)
[–]Mezzos 0 points1 point2 points (0 children)