Posts

Showing posts from October, 2017

How to install PostgreSQL and pgAdmin4 on Ubuntu 18.04

1. Install PostgreSQL $ sudo apt update $ sudo apt install postgresql postgresql-contrib 2. Update password for postpres user $ sudo -u postgres psql postgres=# ALTER USER user_name WITH PASSWORD 'new_password'; postgres=# \q 3. Install Python PIP for Ubuntu $ sudo apt update $ sudo apt install python3-pip 4. Get the PgAdmin 4 Python Installer at https://www.pgadmin.org/download/pgadmin-4-python-wheel 5. Install pgAdmin4 $ pip install ~/Downloads/pgadmin4*.whl Or for a System wide installation: $ sudo pip install ~/Downloads/pgadmin4*.whl 6. Locate PgAdmin 4 Script $ sudo updatedb $ locate pgAdmin4.py Copy the path displayed from above command. I call it PATH /pgAdmin4.py from now 7. Create config_local.py file for pgAdmin4 local config, add content and save it $ vim PATH /config_local.py import os SERVER_MODE = False DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/')) LOG_FILE = os.path.join(DATA_DIR...

Elixir Ecto - My Notes

Image
Elixir Structs :         Elixir provides Structs.Structs define a set of fields.         A Struct will be referenced by the name of the module where it is defined defmodule User do defstruct [ :name , :email ] end user = % User { name: "John Doe" , email: "john@example.com" } Once a user Struct is created, we can access its email via user.email. Relational Mappers :          An Object Relational Mapper manage the translation of objects in to relational database, and  vice versa Similarly Ecto provides schemas that maps any Data source(Database Tables) in to Elixir Struct.When applied to your Database, Elixir schemas are Relational Mappers. Therefore while Ecto is not a Relational Mapper, it contains a Relational Mapper as a part of the many different tools it offers. For example, the schema below ties the fields name, email, inserted_at and updated_at to fields si...