AWS hints, tips and how-tos. Things that have been picked while building out our AWS environment.
Redshift - Show Tables in schema
Get link
Facebook
X
Pinterest
Email
Other Apps
select t.table_name
from information_schema.tables t
where t.table_schema = 'myschema'-- put your schema name here
and t.table_type = 'BASE TABLE'
orderby t.table_name;
From the CLI you can delete all files recursively of the same name (/mydata.csv) using This is for cases where a file of the same name appears in subfolders of a bucket and you want to delete all occurences of that file. If you have bucket versioning turned on then you will not actually lose the file forever. aws s3 rm s3://mybucket/toplevelfolder/ --recursive --exclude "*" --include "*/mydata.csv" If you are paranoid about screwing things up there’s an optional – dryrun parameter that generates a report of what will be deleted, without actually deleting. aws s3 rm s3:// mybucket/toplevelfolder / --dryrun --recursive --exclude "*" --include "*/metadata.csv" (dryrun) delete: s3:// mybucket/toplevelfolder /part_2/mydata.csv (dryrun) delete: s3:// mybucket/toplevelfolder /part_3/mydata.csv
Formatting datetime in Python can be a 'pain'. Formatting works in two directions - From a string to datetime. - From a datetime to string. The easiest way to remember how things work using the strptime and strftime is that: strptime (string)(parse)(time) strftime (string)(format)(time) Format a datetime to a string from datetime import datetime print(datetime.today( ).strftime('%Y-%m-%d %H:%M:%S')) 2020-07-22 10:07:16 Parse a String to datetime from datetime import datetime date_time = ' 2020-07-22 10:07:16 ' dt_object = datetime .strptime(date_time, ' %Y-%m-%d %H:%M:%S' )
On the Oracle RDS service in AWS you have no real SYS/SYSDBA account or physical machine. So how do you grant select on SYS objects? AWS have the RDSADMIN account with some useful packages and I have used one of the procedures in RDSADMIN_UTIL to do the job. -- Granting Permissions to SYS Objects in AWS RDS -- In RDS you do not have access to the server or to a proper SYSDBA account. -- begin rdsadmin . rdsadmin_util . grant_sys_object ( p_obj_name => ' V_$SESSION ' , p_grantee => 'DASHVIEW ' , p_privilege => ' SELECT ' ) ; end ; /
Comments
Post a Comment