I am using the wrds
module in Python to extract data from WRDS. In SAS, I can easily upload a local file to the WRDS server to use in a SQL statement on the WRDS server. The code for that is:
proc upload data=mydatafile out=mydatafile; run;
Is there something similar in Python? I have a Pandas DataFrame called send_to_crsp
containing tickers and dates that I'd like to use in the raw_sql
statement below:
import pandas as pd
import wrds
db = wrds.Connection()
rets = db.raw_sql('''
select a.TIC, a.DATE_FILED0, a.DATE_FILED5, b.date, b.ret
from send_to_crsp as a, crsp.dsf as b
where a.TIC=b.tic and b.date >= a.DATE_FILED and b.date <= a.DATE_FILED5
''',
date_cols = ['DATE_FILED0','DATE_FILED5','date'])