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

Possibilitar importação de projetos, datasets e tabelas como AmoraModel #323

Open
diogommartins opened this issue Mar 7, 2023 · 0 comments
Labels
CLI enhancement New feature or request python Pull requests that update Python code

Comments

@diogommartins
Copy link
Contributor

Interfaces envolvidas

Possibilitar a listagem de tabelas pertencentes a um projeto ou dataset:

  • amora.providers.bigquery.list_tables_for_project(project: str) -> List[str]: retorna lista de todas as tabelas contidas em um projeto. Ex.:
list_tables_for_project("amora-data-build-tool")
  • amora.providers.bigquery.list_tables_for_dataset(dataset: str) -> List[str]: retorna lista de todas as tabelas contidas em um dataset. Ex.:
list_tables_for_dataset("amora-data-build-tool.amora")

Possibilitar a importação de uma tabela a partir da sua referëncia

  • amora.providers.bigquery.import_table(table_reference: str) -> AmoraModel
amora.providers.bigquery.import_table("amora-data-build-tool.raw_diogo.HKQuantityTypeIdentifierStepCount_diogommachado")

Gera os seguintes:

  • arquivo para o modelo models/amora_data_build_tool/amora/HKQuantityTypeIdentifierStepCount_diogommachado.py
  • modelo HKQuantityTypeIdentifierStepCount_diogommachado(AmoraModel)
  • retorna referëncia para modelo criado

CLI

amora.cli.models.models_import_project(project_reference: typer.Argument) -> None: importa todas as tabelas de um projeto

amora models import project amora-data-build-tool

amora.cli.models.models_import_dataset(dataset_reference: typer.Argument) -> None: importa todas as tabelas de um dataset de um projeto

amora models import dataset amora-data-build-tool.amora

amora.cli.models.models_import_table(table_reference: typer.Argument) -> None: importa uma tabela

amora models import table amora-data-build-tool.raw_diogo.HKQuantityTypeIdentifierStepCount_diogommachado

Rascunho: https://gist.github.com/diogommartins/c295b03700a3a336af1ef08e147d7a13

@diogommartins diogommartins added enhancement New feature or request CLI python Pull requests that update Python code labels Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI enhancement New feature or request python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

1 participant