Search
 
SCRIPT & CODE EXAMPLE
 

SQL

test the postgresql db connection

psql -U kodekloud_aim -d kodekloud_db8 -h 127.0.0.1 -W  ## Change name according to question
#### for the test on mode postgres u have
## conninfo 
## l
## dg+
## q   # to quit
psql -U kodekloud_gem -d kodekloud_db10 -h localhost -W
Comment

postgres connection check

from sqlalchemy import event
from sqlalchemy import create_engine

engine = create_engine("postgresql+psycopg2://scott:tiger@host/dbname")

@event.listens_for(engine, "connect", insert=True)
def set_search_path(dbapi_connection, connection_record):
    existing_autocommit = dbapi_connection.autocommit
    dbapi_connection.autocommit = True
    cursor = dbapi_connection.cursor()
    cursor.execute("SET SESSION search_path='%s'" % schema_name)
    cursor.close()
    dbapi_connection.autocommit = existing_autocommit
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql get all tables from a specific database 
Sql :: sqlalchemy update row 
Sql :: sql substring 
Sql :: sql row number in result set 
Sql :: sql count unique values in one column 
Sql :: alter table add column in sql server 
Sql :: sql select case when 
Sql :: dual in db2 
Sql :: else if mysql 
Sql :: mysqli connect 
Sql :: inner join distinct 
Sql :: psql execute sql file 
Sql :: mysql execute file 
Sql :: Write an SQL query to print details of the Workers who have joined in Feb’2014 
Sql :: find usage of table in sql server 
Sql :: get cpu details sql 
Sql :: bigquery add days to date 
Sql :: 11:04:35 PM [mysql] Error: MySQL shutdown unexpectedly. 11:04:35 PM [mysql] This may be due to a blocked port, missing dependencies, 
Sql :: Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘a’. 
Sql :: how to find special characters in sql 
Sql :: intellij mysql set timezone 
Sql :: sqlalchemy empty table 
Sql :: minus in sql 
Sql :: get initial in sql 
Sql :: oracle change tablespace size 
Sql :: Get all index postgres 
Sql :: how to print sql query 
Sql :: how to declare a variable in sql 
Sql :: sum mysql 
Sql :: if else in mysql stored procedure 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =