Skip to content
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

JDBC sources: Improve source column type logs #18193

Merged
merged 1 commit into from
Oct 19, 2022
Merged

Conversation

edgao
Copy link
Contributor

@edgao edgao commented Oct 19, 2022

These logs currently look like Table THE_TABLE_NAME column THE_COLUMN_NAME (type VARCHAR[16777216]) -> false. That false represents nullability, and we're not logging the json schema at all.

Fix the log template so that it actually logs all the parameters, and puts them in the right place.

@edgao edgao requested a review from a team as a code owner October 19, 2022 23:10
@github-actions github-actions bot added the area/connectors Connector related issues label Oct 19, 2022
@edgao edgao temporarily deployed to more-secrets October 19, 2022 23:11 Inactive
@github-actions
Copy link
Contributor

NOTE ⚠️ Changes in this PR affect the following connectors. Make sure to run corresponding integration tests:

  • source-oracle
  • source-snowflake
  • source-mssql
  • source-mssql-strict-encrypt
  • source-mysql-strict-encrypt
  • source-cockroachdb
  • source-redshift
  • source-db2
  • source-oracle-strict-encrypt
  • source-bigquery
  • source-scaffold-java-jdbc
  • source-postgres
  • source-alloydb
  • source-postgres-strict-encrypt
  • source-clickhouse-strict-encrypt
  • source-db2-strict-encrypt
  • source-alloydb-strict-encrypt
  • source-tidb
  • source-clickhouse
  • source-mysql
  • source-cockroachdb-strict-encrypt

@edgao
Copy link
Contributor Author

edgao commented Oct 19, 2022

meh, don't really want to publish this change on its own, going to just merge it

@edgao edgao merged commit e361ef6 into master Oct 19, 2022
@edgao edgao deleted the edgao/jdbc_source_logs branch October 19, 2022 23:19
@@ -193,7 +193,7 @@ protected List<TableInfo<CommonField<Datatype>>> discoverInternal(final JdbcData
.map(f -> {
final Datatype datatype = getFieldType(f);
final JsonSchemaType jsonType = getType(datatype);
LOGGER.info("Table {} column {} (type {}[{}]) -> {}",
LOGGER.info("Table {} column {} (type {}[{}], nullable {}) -> {}",
Copy link
Contributor

@ryankfu ryankfu Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing as the (type {}[{}], nullable {}) isn't abundantly clear on what the format is can this also be updated to have explicit updates to say column size? I guess even the ending -> {} isn't explicitly clear that it represents jsonType information unless someone knew this LOGGER line existed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

welp. I timed that merge very poorly. do you feel strongly enough to warrant opening a new pr >.>

fwiw the syntax VARCHAR[123] is probably not awful, since most SQL-based systems will use something like e.g. NUMBER(42) to represent a 42-digit number. nullable false is... not great, but my hope is that it's at least understandable?

Final log message should look something like:

Table THE_TABLE_NAME column THE_COLUMN_NAME (type VARCHAR[16777216], nullable false) -> {"type": "string"}

which is hopefully not awful

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on what you've showed with an example log message, would say the current change is sufficient

jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
@grishick grishick added the team/destinations Destinations team's backlog label Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues connectors/source/jdbc team/destinations Destinations team's backlog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants