Posts

Showing posts with the label Postgresql

How to migrate data from SQLite to PostgreSQL in Django

Image
  Hi DEVs! In this post I want to talk about differences between SQLite and PostgreSQL. In addition, I will show you how to migrate your data from SQLite to PostgreSQL. Well, SQLite and PostgreSQL are the most widely used relational database management systems. They are both open-source and free. However, they have some major differences that should be considered when choosing a database to use for your applications. There is a lot articles on internet which covers this topic, so I will not focus on comparison of these databases. SQLite vs PostgreSQL - Which database to use and why? SQLite vs MySQL vs PostgreSQL: A Comparison Of Relational Database Management Systems SQLite is too "light" for real world applications, so majority of developers prefer to use MySQL or PostgreSQL for web applications. Generally, SQLite is highly useful for: Standalone apps Small apps that don’t require expansion Apps need to read or write files to disk directly The internet of things devices Deve...

How to change PostgreSQL database encoding to UTF8

  The default encoding of the template databases in PostgreSQL is set to SQL_ASCII. If this encoding has not been changed, then the new databases will be created using this template and hence will have the same encoding SQL_ASCII. Overall this should not be a big problem unless Unicode data is required to be saved in the database. In that case you will receive an error such as : Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8. In this blog, we will go through all steps in order to change the encoding of the database to UTF8. First of all one needs to know that encoding of already created database cannot be altered. Hence we need to drop and create a new one. Checking the current server encoding. postgres@yourserver : ~ $ psql psql ( 10.7 ( Ubuntu 10.7 - 0ubuntu0 .18 . 04.1 ) ) Type "help" for help . postgres = # SHOW SERVER_ENCODING; server_encoding - - - - - - - - - - - - - - - - - SQL_ASCII ( 1 row ) po...

Github Actions Continuous Integration for a django and Postgresql Web App

Image
  tl;dr –  Here’s a working example of a Django project. We use GitHub extensively – for client projects, for internal projects & for open source. It was a matter of time for GitHub to roll their own CI  & catch up with Bitbucket Pipelines & GitLab CI. Having a CI is integral part of our software development process  – build & lint on every commit, deploy to staging & production from specific branches. We use either CircleCI or CodeShip, depending on the project & the needs. With GitHub Actions now being generally available for everyone, I was itching to give it a go. The final aim of this article is to provide you with a working Django + Postgres example,  share my struggles during the setup. I’ll go step by step and include some of the errors that you might encounter, while trying to set things up. Terminology As with every other CI, I made the mistake to jump right in, start pasting yml configuration around & hoping for the best. O...