简体   繁体   中英

WRDS library and SQL?

I am using the WRDS library to connect to the WRDS databases through Spyder. I import wrds . According to the WRDS website, a query should look like this: result = wrds.sql('select * from dataset', 'variable')

( https://wrds-web.wharton.upenn.edu/wrds/support/Accessing%20and%20Manipulating%20the%20Data/_004Python%20Programming/_001Using%20Python%20with%20WRDS.cfm )

However, I get this error: AttributeError: module 'wrds' has no attribute 'sql'

Did you name your python script 'wrds.py'? This may explain why python does not find the .sql.

In my case the following works:

import wrds
db = wrds.Connection()
libraries = db.list_libraries()
library = 'compg'

tables = db.list_tables(library=library)
table = 'g_company'

result = db.raw_sql('select * from COMPG.G_COMPANY')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM