Adapting types to fix SQLAlchemy's "can't adapt type" error

published on
I have recently been using Pydantic a lot, which is pretty cool since it lets me specify concrete types on my previously untyped data. Until I ran into an error when I was inserting data stored in a Pydantic model to my postgres database using SQLAlchemy. Problem I have a Pydantic model like this to define my incoming data from a request: # Pydantic class class EventSchema(BaseModel): ip_address: IPvAnyAddress Another part in my code defined an SQLAlchemy model to persist this incoming information (along with other data not shown here): Read More...

QTreeView and custom filter models

published on
I’ve been learning PySide which is an amazingly easy library to get into GUI development. For an application I was developing, I needed a search filter for some hierarchical data represented by QTreeView. QSortFilterProxyModel is the default choice to add a filter to a QTreeView, but it, by default, applies the filter to all nodes from any root to leaf. If any node has to show up in the search result, all the nodes from a root to that node have to match the search filter, which is mostly useless for hierarchical data. Read More...