In sqlalchemy
I have a base class Stock
.
Now I'd like to bind some previously scraped items and want to bind them like so:
stock = Stock(isin = item['isin'], name = item['name'], points = item['points'], ...)
This feels very unpythonic and boring.
The keys from item
are named exactly like the internal representation of Stock
, however some items need to be ignored (these start with an underscore, e.g. item['_leave_me_alone']
).
Is there a way to write the above in a better way?