Skip to content

Commit 0721293

Browse files
Add subaccount usernames table to list of tables to export. (backport #2677) (#2697)
Co-authored-by: vincentwschau <99756290+vincentwschau@users.noreply.github.com>
1 parent 43a22ec commit 0721293

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import {
2+
getAthenaTableCreationStatement,
3+
getExternalAthenaTableCreationStatement,
4+
} from '../../helpers/sql';
5+
6+
const TABLE_NAME: string = 'subaccount_usernames';
7+
const RAW_TABLE_COLUMNS: string = `
8+
\`username\` string,
9+
\`subaccountId\` string
10+
`;
11+
const TABLE_COLUMNS: string = `
12+
"username",
13+
"subaccountId"
14+
`;
15+
16+
export function generateRawTable(tablePrefix: string, rdsExportIdentifier: string): string {
17+
return getExternalAthenaTableCreationStatement(
18+
tablePrefix,
19+
rdsExportIdentifier,
20+
TABLE_NAME,
21+
RAW_TABLE_COLUMNS,
22+
);
23+
}
24+
25+
export function generateTable(tablePrefix: string): string {
26+
return getAthenaTableCreationStatement(
27+
tablePrefix,
28+
TABLE_NAME,
29+
TABLE_COLUMNS,
30+
);
31+
}

indexer/services/roundtable/src/tasks/update-research-environment.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import * as athenaOrders from '../lib/athena-ddl-tables/orders';
3333
import * as athenaPerpetualMarkets from '../lib/athena-ddl-tables/perpetual_markets';
3434
import * as athenaPerpetualPositions from '../lib/athena-ddl-tables/perpetual_positions';
3535
import * as athenaPnlTicks from '../lib/athena-ddl-tables/pnl_ticks';
36+
import * as athenaSubaccountUsernames from '../lib/athena-ddl-tables/subaccount_usernames';
3637
import * as athenaSubaccounts from '../lib/athena-ddl-tables/subaccounts';
3738
import * as athenaTendermintEvents from '../lib/athena-ddl-tables/tendermint_events';
3839
import * as athenaTradingRewardAggregations from '../lib/athena-ddl-tables/trading_reward_aggregations';
@@ -64,6 +65,7 @@ export const tablesToAddToAthena: { [table: string]: AthenaTableDDLQueries } = {
6465
affiliate_info: athenaAffiliateInfo,
6566
affiliate_referred_users: athenaAffiliateReferredUsers,
6667
vaults: athenaVaults,
68+
subaccount_usernames: athenaSubaccountUsernames,
6769
};
6870

6971
const statStart: string = `${config.SERVICE_NAME}.update_research_environment`;

0 commit comments

Comments
 (0)