Reputation: 8004
I am following this github link to insert into sql server
here is my code
import pyodbc
import pandas as pd
conn = pyodbc.connect('Driver={SQL Server};'
'Server=******;'
'Database=******;'
'Trusted_Connection=yes;')
cursor = pyodbc.cursor()
I am getting this error
> Traceback (most recent call last):
>
> File "<ipython-input-33-d56faea8bdd3>", line 11, in <module>
> cursor = pyodbc.cursor()
>
> AttributeError: module 'pyodbc' has no attribute 'cursor'
Upvotes: 1
Views: 1441
Reputation: 13401
Use conn.cursor
instead of pyodbc.cursor
import pyodbc
import pandas as pd
conn = pyodbc.connect('Driver={SQL Server};'
'Server=******;'
'Database=******;'
'Trusted_Connection=yes;')
cursor = conn.cursor()
Refer documentation for more details
Upvotes: 2