Demystifying Alembic's Handling of Enum Types in Table AlterationsWhen working with Alembic, the database migration tool for Python, there is an important aspect to consider regarding Enum types. Alembic does not automatically create an enum type when altering a table. Instead, you need to handle the creation manua...May 25, 2023·2 min read·679
Async Database Operations with SQLModelSo far, we've covered how to manage database migrations with SQLModel and Alembic. Next, we are going to perform database operations asynchronously. TL;DR Install an async-powered database engine (like, aiosqlite, asyncpg etc.) poetry add aiosqlite...Jan 30, 2023·4 min read·7.4K
Using SQLModel with AlembicTL;DR Install Alembic and SQLModel. Create models with SQLModel.SQLModel base class. Add naming conventions to SQLModel.metadata using SQLModel.metadata.naming_convention. Initialize Alembic with alembic init migrations. Add your database URL to...Jan 29, 2023·5 min read·5.0K
Solve cuInit: CUDA_ERROR_UNKNOWN: unkown errorSteps Enable the following services in systemd: nvidia-suspend.service nvidia-resume.service nvidia-hibernate.service Enable via sudo systemctl enable <service name>. Create a file named /etc/modprobe.d/nvidia-suspend.conf. Add the foll...Jun 26, 2022·1 min read·47
Making a proper init.lua (For real this time!)TL;DR Just the config? Click here. Aim Our aim is to create a single file configuration for Neovim. There are too many tutorials on nEsTeD cOnFiGs. Real men use a single file to configure an entire editor 😤. Flat is better than nested. ― The Zen o...Jan 27, 2022·15 min read·3.5K
Self Referential Structs in Rust (Part 2)Before You Read I strongly advise you to read Part 1 if you haven't read it yet. It goes into the basics of self referential structs, how a basic solution can be achieved (given below) and the flaws in the design. This article aims to fix the flaws a...Nov 26, 2021·12 min read·1.1K
Self Referential Structs in Rust (Part 1)TL;DR Use Pin<Box<T>> for the held value (here, Me). Mark Me as unpinnable by setting a field as std::marker::PhantomPinned. Eg, _pinned: std::marker::PhantomPinned. Use Rc<RefCell<H>> for holder, (here, Holder) and store Me as raw pointers. Eg, me...Nov 4, 2021·13 min read·22K