basedosdados / mais

⚙️ Código de manutenção do datalake (metadados e pacotes de acesso) | 📖 Docs: https://basedosdados.github.io/mais/
https://info.basedosdados.org/links
MIT License
391 stars 88 forks source link

[infra] Indicar instruções de configuração do GCloud na função `get_table_size` #419

Closed fernandascovino closed 4 months ago

fernandascovino commented 3 years ago

Descrição Quando não indicado um billing_project_id na função get_table_size o erro que aparece é:

TypeError: get_table_size() missing 1 required positional argument: 'billing_project_id'

Seria mais instrutivo aparecer a instrução para configuração do seu project_id sempre que a pessoa não passa esse campo (e ele não é encontrado em nenhuma credencial), assim como na função read_sql e demais que necessitam desse parâmetro:

BaseDosDadosException: 
We are not sure which Google Cloud project should be billed.
First, you should make sure that you have a Google Cloud project.
If you don't have one, set one up following these steps: 
    1. Go to this link https://console.cloud.google.com/projectselector2/home/dashboard
    2. Agree with Terms of Service if asked
    3. Click in Create Project
    4. Put a cool name in your project
    5. Hit create
Copy the Project ID, (notice that it is not the Project Name)
Now, you have two options:
1. Add an argument to your function pointing to the billing project id.
   Like `bd.read_table('br_ibge_pib', 'municipios', billing_project_id=<YOUR_PROJECT_ID>)`
2. You can set a project_id in the environment by running the following command in your terminal: `gcloud config set project <YOUR_PROJECT_ID>`.   Bear in mind that you need `gcloud` installed.

Reproduzir Passos para reproduzir o comportamento:

bd.get_table_size(
    dataset_id="br_inpe_prodes",
    table_id="desmatamento_municipios"
)
vncsna commented 4 months ago

Vou extrair via backend, pra evitar consulta direta no bigquey