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

Support Canner Enterprise DataSource #169

Closed
Tracked by #168
kokokuo opened this issue May 19, 2023 · 0 comments · Fixed by #172
Closed
Tracked by #168

Support Canner Enterprise DataSource #169

kokokuo opened this issue May 19, 2023 · 0 comments · Fixed by #172
Assignees
Labels

Comments

@kokokuo
Copy link
Contributor

kokokuo commented May 19, 2023

What’s the problem you're trying to solve

In order to solve the problem, VulcanSQL should support connecting to Canner Enterprise named CannerDataSource and query tables / materialized views/views / shared tables from each workspace in Canner Enterprise.

Describe the solution you’d like

According to #168, we should inherit DataSource and create CannerDataSource to implement it.

....

export type DataColumn = { name: string; type: string };

export interface DataResult {
  getColumns: () => DataColumn[];
  getData: () => Readable;
}

export interface ExportOptions {
  // The sql query result to export
  sql: string;
  // The directory to export result to file
  directory: string;
  // The profile name to select to export data
  profileName: string;
  // export file format type
  type: CacheLayerStoreFormatType | string;
}

..... 

@VulcanExtension(TYPES.Extension_DataSource, { enforcedId: true })
export abstract class DataSource<
  C = any,
  PROFILE = Record<string, any>
> extends ExtensionBase<C> {
  private profiles: Map<string, Profile<PROFILE>>;

  constructor(
    @inject(TYPES.ExtensionConfig) config: C,
    @inject(TYPES.ExtensionName) moduleName: string,
    @multiInject(TYPES.Profile) @optional() profiles: Profile[] = []
  ) {
    super(config, moduleName);
    this.profiles = profiles.reduce(
      (prev, curr) => prev.set(curr.name, curr),
      new Map()
    );
  }
   abstract execute(options: ExecuteOptions): Promise<DataResult>;

  /**
   * Export query result data to cache file for cache layer loader used
   */
  public export(options: ExportOptions): Promise<void> {
    throw new Error(`Export method not implemented`);
  }

  .....
}
@kokokuo kokokuo changed the title Support connecting Canner Enterprise by DataSource Support Canner Enterprise DataSource May 19, 2023
@kokokuo kokokuo linked a pull request Jun 1, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants