| S No | Parts | Size ( Bytes ) |
Description |
| | ( Bytes ) | |
| S No | Parts | Size ( Bytes ) |
Description |
| -- SQL : PostgreSQL | |
| -- tablename - Name of the table which we want to alter the column | |
| -- columnname - Name of the columnn which we want to change to varchar from other datatype. | |
| ALTER TABLE | |
| tablename | |
| ALTER COLUMN | |
| columnname type varchar using columnname::varchar; |
| -- SQL : Postgresql | |
| -- Query : Kill all the active connection of particular database. | |
| SELECT | |
| pg_terminate_backend(pid) | |
| FROM | |
| pg_stat_activity | |
| WHERE | |
| pid <> pg_backend_pid() | |
| AND datname = 'dev'; -- dev- Database Name which connection needs to be terminate |
| #!/bin/sh | |
| # store start date to a variable | |
| imeron=`date` | |
| echo "Import started: OK" | |
| dumpfile="/home/bob/bobiras.sql" | |
| ddl="set names utf8; " | |
| ddl="$ddl set global net_buffer_length=1000000;" |
| from airflow.hooks.postgres_hook import PostgresHook | |
| from airflow.models import BaseOperator | |
| from airflow.utils.decorators import apply_defaults | |
| class PostgresOperator(BaseOperator): | |
| """ | |
| Executes sql code in a specific Postgres database |
| from airflow.hooks.postgres_hook import PostgresHook | |
| from airflow.models import BaseOperator | |
| from airflow.utils.decorators import apply_defaults | |
| from datetime import datetime, timedelta | |
| from os import environ | |
| import csv | |
| class DataSourceToCsvOperator(BaseOperator): | |
| """ |
| #!/bin/sh | |
| cat <<EOT > /etc/issue | |
| *********************************************************************** | |
| * Access to this computer system is limited to authorised users only. * | |
| * Unauthorised users may be subject to prosecution under the Crimes * | |
| * Act or State legislation * | |
| * * | |
| * Please note, ALL CUSTOMER DETAILS are confidential and must * | |
| * not be disclosed. * |
| # | |
| # Set up the serial console | |
| # | |
| %post | |
| echo ":: Setting up Serial Console ::" >> /root/post.log | |
| perl -p -i -e 's/^(default.*)$/$1\nserial --unit=0 --speed=9600 --data=8 --parity=no --stop=1\nterminal --timeout=5 serial console/' /boot/grub/grub.conf >> /root/post.log 2>&1 | |
| perl -p -i -e 's/^(\s+kernel.*)$/$1 console=tty0 console=ttyS0,9600/' /boot/grub/grub.conf >> /root/post.log 2>&1 | |
| echo "" >> /etc/inittab | |
| echo "# Run serial console on ttyS0" >> /etc/inittab | |
| echo "S1:2345:respawn:/sbin/agetty ttyS0 9600 vt100" >> /etc/inittab |
| # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | |
| # START pre-kvmhost-partitions | |
| # | |
| set \$(list-harddrives) | |
| echo "\$@" | |
| disk=( \$1 \$3 ) | |
| size=( \$2 \$4 ) |