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

Add support to other data sources parsing #4

Open
StavPonte11 opened this issue Mar 14, 2022 · 1 comment
Open

Add support to other data sources parsing #4

StavPonte11 opened this issue Mar 14, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@StavPonte11
Copy link
Owner

Starting with trino (prestosql) and delta

@StavPonte11 StavPonte11 self-assigned this Mar 14, 2022
@StavPonte11 StavPonte11 added the enhancement New feature or request label Mar 14, 2022
@noxify
Copy link

noxify commented Sep 8, 2022

Hi @StavPonte11 ,

i think this "just" a wrapper.

I was able to parse the presto structure with the latest main version with this code snippet:

const parseFields = (
  elements: { name: string; type: string; description: string }[],
) => {
  const parsed = elements.map((element) => {
    const columnParser = {}

    let custom_source = element.type.replace(new RegExp(', ', 'g'), ',')
    custom_source = custom_source.replace(new RegExp(' ', 'g'), ':')

    return parser.parseColumnType(custom_source)
  })

  return parsed
}

Here an example what elements could be:
( we fetch the table schema/columns via https://github.com/tagomoris/presto-client-node#readme and convert the result to the structure below )

const elements = [
  {
    name: "simple",
    type: "varchar",
    description: ""
  },
  {
    name: "complex",
    type: "array(row(sub1 array(varchar), sub2 varchar, sub3 varchar, sub4 varchar, sub5 varchar, sub6 varchar, name varchar, sub7 array(varchar), sub8 boolean, sub9 varchar, sub10 boolean))",
    description: ""
  }
]

Maybe it helps :)

If there are any questions or something else, feel free to give me a ping :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants