1

I'm trying to do a query to an SQL Server 2017 database, and then put the result into a pandas dataframe. I'm using the following code:

    import pyodbc
    import pandas as pd
    conn = pyodbc.connect('Driver={SQL Server};'
                        'Server=SERVERHAJE;'
                        'Database=DATABASE_NAME;'
                        'Trusted_Connection=yes;')

    sql_query=f'Select Field1,Field2 FROM dbo.[TableName] WHERE [status] IS NULL'
    pandas_dataframe = pd.read_sql_query(sql_query,conn)
    print(pandas_dataframe)

But I'm getting the following error:

module 'time' has no attribute 'clock'

I'm using Python 3.8.7 and pandas 1.2.2

What is wrong? Thanks!!

  • 1
    Does this answer your question? [AttributeError: module 'time' has no attribute 'clock' in Python 3.8](https://stackoverflow.com/questions/58569361/attributeerror-module-time-has-no-attribute-clock-in-python-3-8) – some_programmer Mar 01 '21 at 15:18
  • Not really... my question is why pandas is using the clock attribute.... the one you show is with PyCrypto that is not related to pandas.. – Cristian Avendaño Mar 01 '21 at 15:24
  • 1
    Just ran into the same issue - python 3.8 & pandas 1.2.3. Uninstalling pandas using pip and reinstalling pandas from conda worked for me i.e. conda install pandas. Conda pandas version is 0.25.1 – noobie Jun 24 '21 at 03:16

0 Answers0