How to get data from redshift table as dictionary in python

The dict cursors allow to access to the retrieved records using an interface similar to the Python dictionaries instead of the tuples. Add following code into your cursor function cursor_factory=psycopg2.extras.RealDictCursor After adding the above code your cursor should be look like this – cur = con.cursor(cursor_factory=psycopg2.extras.RealDictCursor) if you have an error of not found class .extra – AttributeError: module ‘psycopg2’ has no attribute ‘extras’ Resolved this error by importing class as below import psycopg2 import psycopg2.extras Now if you run this code, you will get data in dictionary from redshift …

Pandas- ImportError: Missing required dependencies [‘numpy’]

This is a common error that sometimes occur when importing pandas library. Here I am sharing the solution for that. So please follow as I described below and if you found any difficulty, intimate me by your comment. Problem:- >>> import pandas Traceback (most recent call last):   File “<stdin>”, line 1, in <module>   File “/home/anil/anaconda3/lib/python3.6/site-packages/pandas/__init__.py”, line 19, in <module>     “Missing required dependencies {0}”.format(missing_dependencies)) ImportError: Missing required dependencies [‘numpy’] Solution:- check all folder list in your python lib folder -> ls -la Now if you see numpy…

Process to Change MySql ip-Address to Listen for all IP’s

*************** process to change MySql ipaddress to listen for all ip ******** -> update user set Host=”%” where User=”phpmyadmin”; -> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf [change “bind-address = 0.0.0.0”] -> flush privilage -> check by netstat -nlp | grep 3306 [ouput should be start listen on 0.0.0.0] -> telnet 192.168.1.19 3306 [now check its connecting or not with the ip]

Safest Way to Merge A Git Branch Into Master

git merge branch

In this article I am going to explain you about the safest way to merge a git branch(stage branch) into master branch. Git Merge :- ((git merge branch) Never forget to take a pull from your master branch after pushing your all new changes to yourcurrent git branch. If your current branch(stage branch) is up to date and now you want to merge your current branch (stage branch)with master branch then follow below process.Explore phpmypassion for more updates and Follow us on facebook progmypassion/ first checkout to master branch then…

Top Mostly Used Git Commands

************************** Git clone a Repository ****************** git clone <repository_url> ************************ Check git branch ********************* git branch ************************ Git Create Branch ************* Git checkout -b <branch-name> ************************ Checkout to another branch ************* Git checkout <branch-name> ************************ Make your file same as git repository ************* Git checkout <file-name> -> for all files :- Git checkout . ************************* Git commit command ********************* git add . [for all files] git commit -m “your comment” ************************* Git push command ********************** git push origin <your-branch-name> *********************** Git pull command ************************ git pull origin <your-branch-name> *********************** Git…

List of Top Docker Commands in Linux

Docker works just like Git. you have to always take a pull for latest image. ****************************** Docker install ****************** sudo apt-get update sudo apt-get install docker.io **************************** Check docker installed or not ************* docker ps -a ************************* Login to AWS container via command line ************  $(aws ecr get-login –no-include-email –region us-east-1) get-login [–registry-ids <value> [<value>…]] [–include-email | –no-include-email] **************************** pull the docker image ************* docker pull your-server.us-east-1.amazonaws.com/aws_repository ************************** Docker push image ************************************** -> commit your changes first docker commit <your-container-name> your-server.us-east-1.amazonaws.com/aws_repository:v2.2 (v2.2 is the tagging  version) -> Now run push…

How To Remove Docker Images ?

Removing Docker Images Remove one or more specific images Use the docker images command with the -a flag to locate the ID of the images you want to remove. This will show you every image, including intermediate image layers. When you’ve located the images you want to delete, you can pass their ID or tag to docker rmi: List: docker images -a Remove: docker rmi Image Image