-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ingestion: Added form in Big Query type to edit the queries. #5431
Changes from 5 commits
3fb7548
8d35bf4
b73526c
289c360
16d4d6f
ad05dd0
7db5f01
06c1c49
81b7ad7
f269250
bfd1099
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { Button, Checkbox, Form, Input, Tooltip } from 'antd'; | ||
import React from 'react'; | ||
import { Button, Checkbox, Form, Input, Select, Tooltip } from 'antd'; | ||
import styled from 'styled-components/macro'; | ||
import { MinusCircleOutlined, PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons'; | ||
import { FieldType, RecipeField } from './utils'; | ||
|
@@ -52,6 +52,10 @@ interface ListFieldProps { | |
removeMargin?: boolean; | ||
} | ||
|
||
interface SelectFieldProps { | ||
field: RecipeField; | ||
} | ||
|
||
function ListField({ field, removeMargin }: ListFieldProps) { | ||
return ( | ||
<Form.List name={field.name}> | ||
|
@@ -80,6 +84,30 @@ function ListField({ field, removeMargin }: ListFieldProps) { | |
); | ||
} | ||
|
||
function SelectField({ field }: SelectFieldProps) { | ||
return ( | ||
<Form.Item | ||
name={field.name} | ||
label={ | ||
<Label> | ||
{field.label} | ||
<Tooltip overlay={field.tooltip}> | ||
<StyledQuestion /> | ||
</Tooltip> | ||
</Label> | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here you can actually just let ant design do this work for you! so you can just pass in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked and fixed. |
||
> | ||
{field.tableLineages && ( | ||
<Select> | ||
{field.tableLineages.map((lineage) => ( | ||
<Select.Option value={lineage.value}>{lineage.label}</Select.Option> | ||
))} | ||
</Select> | ||
)} | ||
</Form.Item> | ||
); | ||
} | ||
|
||
interface Props { | ||
field: RecipeField; | ||
removeMargin?: boolean; | ||
|
@@ -90,6 +118,8 @@ function FormField(props: Props) { | |
|
||
if (field.type === FieldType.LIST) return <ListField field={field} removeMargin={removeMargin} />; | ||
|
||
if (field.type === FieldType.SELECT) return <SelectField field={field} />; | ||
|
||
const isBoolean = field.type === FieldType.BOOLEAN; | ||
const input = isBoolean ? <Checkbox /> : <Input />; | ||
const valuePropName = isBoolean ? 'checked' : 'value'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
import { set, get } from 'lodash'; | ||
import { SNOWFLAKE } from '../../conf/snowflake/snowflake'; | ||
import { BIGQUERY } from '../../conf/bigquery/bigquery'; | ||
import { REDSHIFT } from '../../conf/redshift/redshift'; | ||
|
||
export enum FieldType { | ||
TEXT, | ||
BOOLEAN, | ||
LIST, | ||
SELECT, | ||
} | ||
|
||
interface LineageType { | ||
label: string; | ||
value: string; | ||
} | ||
|
||
export interface RecipeField { | ||
|
@@ -15,6 +23,7 @@ export interface RecipeField { | |
fieldPath: string; | ||
rules: any[] | null; | ||
section?: string; | ||
tableLineages?: LineageType[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in order to make this more generalizable let's name this field There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked and fixed. |
||
getValueFromRecipeOverride?: (recipe: any) => any; | ||
setValueOnRecipeOverride?: (recipe: any, value: any) => any; | ||
} | ||
|
@@ -102,6 +111,97 @@ export const SNOWFLAKE_ROLE: RecipeField = { | |
rules: null, | ||
}; | ||
|
||
export const BIGQUERY_PROJECT_ID: RecipeField = { | ||
name: 'project_id', | ||
label: 'BigQuery Project ID', | ||
tooltip: | ||
'Project ID to ingest usage from. If not specified, will infer from environment. Deprecated in favour of projects.', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm where did you get this description? Let's change it to just be "Project ID where you have rights to run queries and create tables." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked and fixed. |
||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.project_id', | ||
rules: null, | ||
}; | ||
|
||
export const BIGQUERY_CREDENTIAL_PROJECT_ID: RecipeField = { | ||
name: 'credential.project_id', | ||
label: 'Credentials Project ID', | ||
tooltip: 'Project id to set the credentials.', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.credential.project_id', | ||
rules: null, | ||
}; | ||
|
||
export const BIGQUERY_PRIVATE_KEY_ID: RecipeField = { | ||
name: 'credential.private_key_id', | ||
label: 'Private Key Id', | ||
tooltip: 'Private key id.', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.credential.private_key_id', | ||
rules: null, | ||
}; | ||
|
||
export const BIGQUERY_PRIVATE_KEY: RecipeField = { | ||
name: 'credential.private_key', | ||
label: 'Private Key', | ||
tooltip: 'Private key in a form of "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n".', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.credential.private_key', | ||
rules: null, | ||
}; | ||
|
||
export const BIGQUERY_CLIENT_EMAIL: RecipeField = { | ||
name: 'credential.client_email', | ||
label: 'Client Email', | ||
tooltip: 'Client email.', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.credential.client_email', | ||
rules: null, | ||
}; | ||
|
||
export const BIGQUERY_CLIENT_ID: RecipeField = { | ||
name: 'credential.client_id', | ||
label: 'Client ID', | ||
tooltip: 'Client ID.', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.credential.client_id', | ||
rules: null, | ||
}; | ||
|
||
export const REDSHIFT_HOST_PORT: RecipeField = { | ||
name: 'host_port', | ||
label: 'Host Port', | ||
tooltip: 'Host URL.', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.host_port', | ||
rules: null, | ||
}; | ||
|
||
export const REDSHIFT_DATABASE: RecipeField = { | ||
name: 'database', | ||
label: 'Database', | ||
tooltip: 'Database (catalog).', | ||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.database', | ||
rules: null, | ||
}; | ||
|
||
export const REDSHIFT_USERNAME: RecipeField = { | ||
name: 'redshift.username', | ||
label: 'Username', | ||
tooltip: 'Username', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know the docs just say "Username" but maybe let's change to "Redshift username" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked and fixed. |
||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.username', | ||
rules: null, | ||
}; | ||
|
||
export const REDSHIFT_PASSWORD: RecipeField = { | ||
name: 'redshift.password', | ||
label: 'Password', | ||
tooltip: 'Password', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar here - "Reshift password" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked and fixed. |
||
type: FieldType.TEXT, | ||
fieldPath: 'source.config.password', | ||
rules: null, | ||
}; | ||
|
||
const includeLineageFieldPathA = 'source.config.include_table_lineage'; | ||
const includeLineageFieldPathB = 'source.config.include_view_lineage'; | ||
export const INCLUDE_LINEAGE: RecipeField = { | ||
|
@@ -157,6 +257,29 @@ export const STATEFUL_INGESTION_ENABLED: RecipeField = { | |
rules: null, | ||
}; | ||
|
||
export const INCLUDE_UPSTREAM_LINEAGE_IN_REPORT: RecipeField = { | ||
name: 'include_upstream_lineage_in_report', | ||
label: 'Include Upstream Lineage In Report.', | ||
tooltip: 'Useful for debugging lineage information. Set to True to see the raw lineage created internally.', | ||
type: FieldType.BOOLEAN, | ||
fieldPath: 'source.config.include_upstream_lineage_in_report', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the name and resulting fieldpath should just be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked and fixed. |
||
rules: null, | ||
}; | ||
|
||
export const TABLE_LINEAGE_MODE: RecipeField = { | ||
name: 'table_lineage_mode', | ||
label: 'Table Lineage Mode', | ||
tooltip: 'Option to enable/disable lineage generation. Is enabled by default.', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's change to "Which table lineage collector mode to use. Check out the documentation explaining the difference between the three available modes." where "the documentation" is a link to https://datahubproject.io/docs/generated/ingestion/sources/redshift/#lineage |
||
type: FieldType.SELECT, | ||
fieldPath: 'source.config.table_lineage_mode', | ||
rules: null, | ||
tableLineages: [ | ||
{ label: 'stl_scan_based', value: 'stl_scan_based' }, | ||
{ label: 'sql_based', value: 'sql_based' }, | ||
{ label: 'mixed', value: 'mixed' }, | ||
], | ||
}; | ||
|
||
const databaseAllowFieldPath = 'source.config.database_pattern.allow'; | ||
export const DATABASE_ALLOW: RecipeField = { | ||
name: 'database_pattern.allow', | ||
|
@@ -282,6 +405,28 @@ export const RECIPE_FIELDS = { | |
VIEW_DENY, | ||
], | ||
}, | ||
[BIGQUERY]: { | ||
fields: [ | ||
BIGQUERY_PROJECT_ID, | ||
BIGQUERY_CREDENTIAL_PROJECT_ID, | ||
BIGQUERY_PRIVATE_KEY, | ||
BIGQUERY_PRIVATE_KEY_ID, | ||
BIGQUERY_CLIENT_EMAIL, | ||
BIGQUERY_CLIENT_ID, | ||
], | ||
advancedFields: [ | ||
INCLUDE_LINEAGE, | ||
PROFILING_ENABLED, | ||
STATEFUL_INGESTION_ENABLED, | ||
INCLUDE_UPSTREAM_LINEAGE_IN_REPORT, | ||
], | ||
filterFields: [TABLE_ALLOW, TABLE_DENY, SCHEMA_ALLOW, SCHEMA_DENY, VIEW_ALLOW, VIEW_DENY], | ||
}, | ||
[REDSHIFT]: { | ||
fields: [REDSHIFT_HOST_PORT, REDSHIFT_DATABASE, REDSHIFT_USERNAME, REDSHIFT_PASSWORD], | ||
advancedFields: [INCLUDE_LINEAGE, PROFILING_ENABLED, STATEFUL_INGESTION_ENABLED, TABLE_LINEAGE_MODE], | ||
filterFields: [TABLE_ALLOW, TABLE_DENY, SCHEMA_ALLOW, SCHEMA_DENY, VIEW_ALLOW, VIEW_DENY], | ||
}, | ||
}; | ||
|
||
export const CONNECTORS_WITH_FORM = new Set(Object.keys(RECIPE_FIELDS)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,10 @@ source: | |
client_id: # Your BQ client id, e.g. "123456678890" | ||
`; | ||
|
||
export const BIGQUERY = 'bigquery'; | ||
|
||
const bigqueryConfig: SourceConfig = { | ||
type: 'bigquery', | ||
type: BIGQUERY, | ||
Comment on lines
+24
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you:) |
||
placeholderRecipe, | ||
displayName: 'BigQuery', | ||
docsUrl: 'https://datahubproject.io/docs/generated/ingestion/sources/bigquery/', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you make it so that the select dropdown and the label are on the same line? instead of the selector being on a second line right now. And can you also make the selector not quite so wide? so like
width: 80%;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked and fixed.