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..6a578dcdec 100644 --- a/indexer/services/roundtable/src/tasks/update-research-environment.ts +++ b/indexer/services/roundtable/src/tasks/update-research-environment.ts @@ -33,6 +33,7 @@ import * as athenaOrders from '../lib/athena-ddl-tables/orders'; import * as athenaPerpetualMarkets from '../lib/athena-ddl-tables/perpetual_markets'; import * as athenaPerpetualPositions from '../lib/athena-ddl-tables/perpetual_positions'; import * as athenaPnlTicks from '../lib/athena-ddl-tables/pnl_ticks'; +import * as athenaSubaccountUsernames from '../lib/athena-ddl-tables/subaccount_usernames'; import * as athenaSubaccounts from '../lib/athena-ddl-tables/subaccounts'; import * as athenaTendermintEvents from '../lib/athena-ddl-tables/tendermint_events'; import * as athenaTradingRewardAggregations from '../lib/athena-ddl-tables/trading_reward_aggregations'; @@ -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`;