From c8790e05f1b1827b9d1d2dce41c1d9f791ea31b5 Mon Sep 17 00:00:00 2001 From: Vincent Chau <99756290+vincentwschau@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:19:42 -0500 Subject: [PATCH] Add subaccount usernames table to list of tables to export. --- .../athena-ddl-tables/subaccount_usernames.ts | 31 +++++++++++++++++++ .../src/tasks/update-research-environment.ts | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 indexer/services/roundtable/src/lib/athena-ddl-tables/subaccount_usernames.ts diff --git a/indexer/services/roundtable/src/lib/athena-ddl-tables/subaccount_usernames.ts b/indexer/services/roundtable/src/lib/athena-ddl-tables/subaccount_usernames.ts new file mode 100644 index 0000000000..577f450821 --- /dev/null +++ b/indexer/services/roundtable/src/lib/athena-ddl-tables/subaccount_usernames.ts @@ -0,0 +1,31 @@ +import { + getAthenaTableCreationStatement, + getExternalAthenaTableCreationStatement, +} from '../../helpers/sql'; + +const TABLE_NAME: string = 'subaccount_usernames'; +const RAW_TABLE_COLUMNS: string = ` + \`username\` string, + \`subaccountId\` string +`; +const TABLE_COLUMNS: string = ` + "username", + "subaccountId" +`; + +export function generateRawTable(tablePrefix: string, rdsExportIdentifier: string): string { + return getExternalAthenaTableCreationStatement( + tablePrefix, + rdsExportIdentifier, + TABLE_NAME, + RAW_TABLE_COLUMNS, + ); +} + +export function generateTable(tablePrefix: string): string { + return getAthenaTableCreationStatement( + tablePrefix, + TABLE_NAME, + TABLE_COLUMNS, + ); +} diff --git a/indexer/services/roundtable/src/tasks/update-research-environment.ts b/indexer/services/roundtable/src/tasks/update-research-environment.ts index 24427bfd8c..d438c469d0 100644 --- a/indexer/services/roundtable/src/tasks/update-research-environment.ts +++ b/indexer/services/roundtable/src/tasks/update-research-environment.ts @@ -40,6 +40,7 @@ import * as athenaTradingRewards from '../lib/athena-ddl-tables/trading_rewards' import * as athenaTransfers from '../lib/athena-ddl-tables/transfers'; import * as athenaVaults from '../lib/athena-ddl-tables/vaults'; import * as athenaWallets from '../lib/athena-ddl-tables/wallets'; +import * as athenaSubaccountUsernames from '../lib/athena-ddl-tables/subaccount_usernames'; export const tablesToAddToAthena: { [table: string]: AthenaTableDDLQueries } = { asset_positions: athenaAssetPositions, @@ -64,6 +65,7 @@ export const tablesToAddToAthena: { [table: string]: AthenaTableDDLQueries } = { affiliate_info: athenaAffiliateInfo, affiliate_referred_users: athenaAffiliateReferredUsers, vaults: athenaVaults, + subaccount_usernames: athenaSubaccountUsernames, }; const statStart: string = `${config.SERVICE_NAME}.update_research_environment`;