Create Multi-Column Index in SQLAlchemy

Defining Multi-Column Indexes Using ORM Declarative Mapping

from sqlalchemy import create_engine, Column, Integer, String, Index
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

engine = create_engine('postgresql://username:password@localhost/mydatabase')
Base = declarative_base()

class Employee(Base):
    __tablename__ = 'employees'
    id = Column(Integer, primary_key=True)
    last_name = Column(String)
    first_name = Column(String)
    department_id = Column(Integer)

    __table_args__ = (
        Index('idx_employees_last_first', 'last_name', 'first_name'),


Creating Indexes After Table Definition

from sqlalchemy import create_engine, MetaData, Table, Index

engine = create_engine('postgresql://username:password@localhost/mydatabase')
metadata = MetaData(bind=engine)

# Reflect the existing table
employees = Table('employees', metadata, autoload_with=engine)

# Create the index
index = Index('idx_employees_last_first', employees.c.last_name, employees.c.first_name)


Install Realm Object Server on Ubuntu 16.04

// Ubuntu 16.04 (64 bit; 32-bit is not supported)
//It is recommended that you install the server as a normal user.

sudo apt-get update

sudo apt-get install build-essential libssl-dev

sudo apt-get install python

curl -o- | bash

// Force current session to know changes or logout and log back in
source ~/.profile

nvm install --lts

npm install -g node-gyp
npm install -g realm-object-server


Installing Apache Cassandra on Ubuntu

echo "deb 39x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl | sudo apt-key add -
sudo apt-get update
sudo apt-key adv --keyserver --recv-key A278B781FE4B2BDA
sudo apt-get install cassandra
sudo service cassandra start
sudo service cassandra stop


Install MongoDB as Windows Service

mkdir c:\data\db
mkdir c:\data\log

create a file at C:\mongodb\mongod.cfg

    destination: file
    path: c:\data\log\mongod.log
    dbPath: c:\data\db

Install the MongoDB service

"C:\mongodb\bin\mongod.exe" --config "C:\mongodb\mongod.cfg" --install

Start the MongoDB service

net start MongoDB

Stop or remove the MongoDB service as needed

net stop MongoDB
"C:\mongodb\bin\mongod.exe" --remove

References :