pricedb/app.py
def import_prices(self, file_path: str, currency_symbol: str):
        """ Incomplete """
        from .csv import CsvParser

        assert isinstance(file_path, str)
        assert isinstance(currency_symbol, str)

        self.logger.debug(f"Importing {file_path}")
        parser = CsvParser()
        prices = parser.parse_file(file_path, currency_symbol)

        counter = 0
        session = self.session
        # Create insert statements
        mapper = mappers.PriceMapper()
        for price in prices:
            new_price = mapper.map_model(price)
            self.add_price_entity(new_price)
            counter += 1
        # Save all to database
        session.commit()
        print(f"{counter} records inserted.")
def import_prices(self, file_path: str, currency_symbol: str):
        """ Incomplete """
        from .csv import CsvParser

        assert isinstance(file_path, str)
        assert isinstance(currency_symbol, str)

        self.logger.debug(f"Importing {file_path}")
        parser = CsvParser()
        prices = parser.parse_file(file_path, currency_symbol)

        counter = 0
        session = self.session
        # Create insert statements
        mapper = mappers.PriceMapper()
        for price in prices:
            new_price = mapper.map_model(price)
            self.add_price_entity(new_price)
            counter += 1
        # Save all to database
        session.commit()
        print(f"{counter} records inserted.")
def import_prices ( self , file_path : str , currency_symbol : str ) : from . csv import CsvParser assert isinstance ( file_path , str ) assert isinstance ( currency_symbol , str ) self . logger . debug ( f"Importing {file_path}" ) parser = CsvParser ( ) prices = parser . parse_file ( file_path , currency_symbol ) counter = 0 session = self . session # Create insert statements mapper = mappers . PriceMapper ( ) for price in prices : new_price = mapper . map_model ( price ) self . add_price_entity ( new_price ) counter += 1 # Save all to database session . commit ( ) print ( f"{counter} records inserted." )
Incomplete
Incomplete