Skip to main content

Posts

Showing posts from September, 2022

Amazon Redshift Daily Command

Amazon Redshift Daily: SELECT CURRENT_AWS_ACCOUNT; SELECT CURRENT_DATABASE(); SELECT CURRENT_NAMESPACE(); SELECT CURRENT_SCHEMA(); SELECT CURRENT_USER_ID(); SELECT CURRENT_USER; -- Metadata select distinct(nspname) from pg_catalog.pg_namespace where nspname not like 'pg_temp%'; -- Describe Table select * from information_schema.columns where table_name='columns'; select column_name, data_type, character_maximum_length from information_schema.columns where table_name='columns'; -- Create Read-only Group Create group ro_group; -- Create User Crate user ro_user with password <password>; -- Add user to Read-only Group alter group ro_group ADD user ro_user; -- Grant Usage permission to Read-Only Group to specific schema grant usage on schema "ro_schema" to group ro_group; -- Grant select permisson to read-only group to specific schema grant select on all tables in schema "ro_schema" to group "ro_group"; -- Alter default privileges ...

Confugure SSH Tunnel with Putty for Windows and MacOS

Configure SSH tunnel for Putty: Here we are going to configure SSH tunnel to connect Amazon bastian host for Amazon Redshit. The purpose of this configuration is to open tunnel, so if you have Python script to validate data, you can execute it either on command prompt or using PyCharm. This configuration is application to Windows env.  Select session 01. Host Name: LunuxID@global-consumer-np-bastian host.subdomain.domain.com 02. Port: 22 03. Connection type: SSH 04. Save Session: RS Dev Under Connection --> SSH --> Tunnels -->  01. Source port - 5439 02. Destination - global-consumer-np-rs.subdomain.domain.com:5439 It will add the value as follows L5439     global-consumer-np-subdomain.domain.com:5439 For Mac OS: 01. Open terminal window 02. Type the following command  ssh -L 5439:global-consumer-np-rs-.subdomain.domain.com:5439 LinuxID@global-consumer-np-bastion.subdomain.domin.com -N