Skip to content

Instantly share code, notes, and snippets.

View maiconbaum's full-sized avatar

Maicon Baum maiconbaum

View GitHub Profile
@maiconbaum
maiconbaum / aws_glue_table_centralized_databricks_audit_logs.sql
Last active March 23, 2023 17:43
AWS Glue Catalog Table for centralized Databricks Audit Logs using Partition Projection.
CREATE EXTERNAL TABLE IF NOT EXISTS databricks_audit_logs (
`version` string,
`timestamp` bigint,
`sourceIPAddress` string,
`userAgent` string,
`sessionId` string,
`userIdentity` STRUCT<
email: STRING
>,
`requestParams` MAP<string, string>,
@maiconbaum
maiconbaum / aws_athena_query.sql
Created December 28, 2022 22:03
AWS Glue Catalog Table for AWS VPC Flow Logs using Apache Hive Compatible Format and Partition Projection.
CREATE EXTERNAL TABLE IF NOT EXISTS aws_vpc_flow_logs (
`version` int,
`account_id` string,
`interface_id` string,
`srcaddr` string,
`dstaddr` string,
`srcport` int,
`dstport` int,
`protocol` bigint,
`packets` bigint,
@maiconbaum
maiconbaum / query.sql
Last active November 23, 2022 21:14
This is a SQL Query to create a table in AWS Glue Data Catalog using Amazon Athena Query Editor in order to query Transit Gateway Flow Logs using Apache Parquet format, with Hive Compatible mode enabled and daily partition.
CREATE EXTERNAL TABLE IF NOT EXISTS transit_gateway (
`version` int,
`resource_type` string,
`account_id` string,
`tgw_id` string,
`tgw_attachment_id` string,
`tgw_src_vpc_account_id` string,
`tgw_dst_vpc_account_id` string,
`tgw_src_vpc_id` string,
`tgw_dst_vpc_id` string,