Skip to content

Commit 4c777a7

Browse files
committed
Introduce SplitgraphURLBatch
- Allows us to fetch a list of Splitgraph URLs - Ideal for SSR time - Also add the id field to each of the three diff queries
1 parent ff17276 commit 4c777a7

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Diff for: data/index.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@ export const SplitgraphURLQuery = gql
3939
}
4040
}
4141
`
42+
export const SplitgraphURLBatch = gql
43+
`query getSocrataRepo($datasets: [SocrataDatasetKey!]!) {
44+
socrataExternalRepositories (datasets: $datasets) {
45+
namespace
46+
repository
47+
}
48+
}
49+
`
4250

43-
export const unifiedFetcher = (query: string) => request(UNIFIED_GQL_API, query)
51+
export const unifiedFetcher = (query: string, variables: any) => request(UNIFIED_GQL_API, query, variables)
4452

4553
/**
4654
* I observed that "20220822" yields diffs but "20220822-180102"

Diff for: data/seafowl.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ORDER BY domain, name, is_added`
3434
* @returns Array<Dataset>, e.g. [{ domain, name, is_added, id, desc }]
3535
*/
3636
export const dailyDiff = (timestamp: string = '2022-11-02 00:00:00') =>
37-
`SELECT d.domain, d.name, is_added, id, d.description
37+
`SELECT d.domain, d.name, is_added, id, d.description, d.id
3838
FROM socrata.daily_diff dd INNER JOIN socrata.all_datasets d
3939
ON dd.id = d.id
4040
WHERE dd.day::text = '${timestamp}'
@@ -54,7 +54,7 @@ export interface DiffResponse {
5454
* @returns Array<Dataset>, e.g. [{ domain, name, is_added, id, desc }]
5555
*/
5656
export const weeklyDiff = (timestamp: string = '2022-10-31 00:00:00') =>
57-
`SELECT d.domain, d.name, is_added, id, d.description
57+
`SELECT d.domain, d.name, is_added, id, d.description, d.id
5858
FROM socrata.weekly_diff w INNER JOIN socrata.all_datasets d
5959
ON w.id = d.id
6060
WHERE w.week::text = '${timestamp}'
@@ -85,7 +85,7 @@ GROUP BY 1
8585
ORDER BY 1 ASC`
8686

8787
export const monthlyDiff = (timestamp: string) =>
88-
`SELECT month, d.domain, d.name, is_added, id, d.description
88+
`SELECT month, d.domain, d.name, is_added, id, d.description, d.id
8989
FROM socrata.monthly_diff m INNER JOIN socrata.all_datasets d
9090
ON m.id = d.id
9191
WHERE m.month::text = '${timestamp}'

0 commit comments

Comments
 (0)