diff --git a/DataProcessing/process.py b/DataProcessing/process.py index 4b2fc4d..3b9e313 100644 --- a/DataProcessing/process.py +++ b/DataProcessing/process.py @@ -210,30 +210,31 @@ def try_create_figi_map(self): self.figi_map = {} db_connection = sqlalchemy.create_engine(self.db_connection_info) - df = pd.read_sql(f'SELECT figi, sid, ticker FROM {self.db_security_table} ORDER BY id DESC', con=db_connection) + with db_connection.connect() as connection: + df = pd.DataFrame(connection.execute(sqlalchemy.text(f'SELECT figi, sid, ticker FROM {self.db_security_table} ORDER BY id DESC'))) - if df.empty: - print('Database contains no FIGI/ticker entries') - return False + if df.empty: + print('Database contains no FIGI/ticker entries') + return False - df = df.drop_duplicates(subset='figi') + df = df.drop_duplicates(subset='figi') - for _, secdef in df.iterrows(): - figi = secdef['figi'] - sid = secdef['sid'] + for _, secdef in df.iterrows(): + figi = secdef['figi'] + sid = secdef['sid'] - if not figi or figi.isspace(): - continue + if not figi or figi.isspace(): + continue - if not sid or sid.isspace(): - continue + if not sid or sid.isspace(): + continue - try: - self.figi_map[figi] = SecurityIdentifier.Parse(sid) - except: - print(f'Failed to parse SID: {sid} for Security: {figi}') + try: + self.figi_map[figi] = SecurityIdentifier.Parse(sid) + except: + print(f'Failed to parse SID: {sid} for Security: {figi}') - return any(self.figi_map) + return any(self.figi_map) def parse_raw(self, file, category, date, lookback_days=None): columns = list(self.category_parsing_columns[category]) + ['COMPOSITE_FIGI'] diff --git a/QuantConnect.DataSource.csproj b/QuantConnect.DataSource.csproj index 124b0b8..5eb25c9 100644 --- a/QuantConnect.DataSource.csproj +++ b/QuantConnect.DataSource.csproj @@ -10,7 +10,7 @@ - +