python#
Flattening nested dict in Python
Flattening a nested dict/json with list as some keys' value.
Install Python3 on Ubuntu
A quick tutorial for installing Python from its official source on Ubuntu with sqlite3 support.
SQLAlchemy mixin in method
If I'm not wrong, the SQLAlchemy official doc provides some examples to explain how to share a set of common columns, some common table options, or other mapped properties, across many classes. But I cannot find how to share common methods (e.g. your customized to_dict() method). This post will just show you a POC to achieve this goal by using Python Mixin.
Troubleshooting Python Twine Cannot Upload Package On Windows
Python has several tools to upload packages to PyPi or some private Artifactory locations. The mostly used one should be twine. Although twine is not a Python originate tool, but it's officially recommended by Python.org.
Filtering In Pandas Dataframe
Pandas dataframe is like a small database, we can use it to inject some data and do some in-memory filtering without any external SQL. This post is much like a summary of this StackOverflow thread.
Using Python SQLAlchemy session in multithreading
SQLAlchemy DB session is not thread safe. In this post, I will show you 2 ways to use it in a multithreading context.
Creating Custom Python Request Auth Class
When you need to use a complicated, or a non-standard API authentication method, or your dev and prd environments don't use the same API authentication method, it might be better to create a Python requests auth method to reduce your work.
Using Gitlab integrated CICD for Python project on Windows
Gitlab ships with its own free CICD which works pretty well. This post will give you an example of the CICD file .gitlab-ci.yml
for a Python project running on Gitlab Windows runner.
Use python tabulate module to create tables
If you want to create some tables from a python list, you can use the tabulate
module, it can generate the table easily in text mode and in many formats, than you can past it into markdown, wiki files or add the print version to your python CLI in order to give a beautiful output to the CLI users.