Coder Social home page Coder Social logo

gestaogovbr / fastetl Goto Github PK

View Code? Open in Web Editor NEW
45.0 7.0 9.0 5.03 MB

Airflow plugins for implementing data pipelines. | Plugins do Airflow para implementação de pipelines de dados.

Home Page: https://pypi.org/project/apache-airflow-providers-fastetl/

License: GNU General Public License v3.0

Python 99.45% Makefile 0.10% Dockerfile 0.36% Shell 0.10%
airflow airflow-operators

fastetl's People

Contributors

augusto-herrmann avatar edulauer avatar kafran avatar luisssguilherme avatar nitaibezerra avatar reonarudo0 avatar salomaolopes avatar vitorbellini avatar washolive avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fastetl's Issues

Empty QA dataframe breaks in `GeoPointDataCleaner` in patchwork

When the QA dataframe in the GeoPointDataCleaner class is empty, it propagates an error because it will generate a data patch file with nans for primary keys.

The empty QA dataframe cases must be handled correctly and do not generate a data patch file.

Decidir o formato padrão para doscstrings no repositório

Precisamos decidir um formato padrão para usar nas docstrings do repositório, documentá-lo nas instruções de contribuição e adaptar as docstrings em todos os módulos Python para que fiquem em conformidade com essa decisão.

Algumas possibilidades de estilo de docstring:

A PEP 287 recomenda o estilo reST. Porém muitos módulos deste repositório já estão usando Google style docstrings.

Mais informações:

Fazer UPDATE em lote no OSRMDistanceDbOperator

Atualmente o parâmetro chunksize faz com que a leitura dos dados (query SELECT) seja feita em lote. Mas a gravação (query UPDATE) ainda está sendo feita linha a linha. É provável que fazê-lo em lotes implique em ganhos de desempenho.

Replace execution_date in templates

Using execution_date inside templates is deprecated in Airflow 2.2.1 and will be removed in a future version. We need to replace it with an alternative.

Currently it throws a warning:

{warnings.py:109} WARNING - /home/***/.local/lib/python3.9/site-packages/***/models/taskinstance.py:1941: DeprecationWarning: Accessing 'execution_date' from the template is deprecated and will be removed in a future version. Please use 'logical_date' or 'data_interval_start' instead.
  warnings.warn(message, DeprecationWarning)

Incluir no OSRMDistanceDbOperator opção de não sobrescrever dados existentes

Atualmente o OSRMDistanceDbOperator sempre escreve a coluna de destino, não importando se nela já constam valores.

Seria interessante ter um parâmetro booleano chamado overwrite_existing para escolher se os valores existentes na coluna serão sobrescritos. Caso seja False, somente valores NULL serão alterados na coluna.

Handle empty dataframe in OrgaosMappingCleaner

If OrgaosMappingCleaner receives an empty dataframe (e.g. when doing an incremental database load and there is no change in data), it fails with the error

KeyError: "None of [Index(['nan'], dtype='object', name='key_name')] are in the [index]"

It should instead handle gracefully, log the occurrence of an empty dataframe and return without error so that the Airflow task can succeed.

Calcular o consumo de dados nas cargas full e incremental

Para contabilizar a quantidade de linhas processadas durante a carga (cópia) dos dados em modo full ou incremental, adicionar 4 parâmetros opcionais nas functions copy_db_to_db e sync_db_2_db:

  • nome da conexão Airflow origem
  • nome da conexão Airflow destino
  • nome do schema da tabela de contabilização
  • nome da tabela de contabilização

Para simplificar, a tabela de contabilização pode residir na mesma conexão da tabela destino.
Para o cálculo, , no caso de full, basta executar um count(*) na tabela ao final da carga. No caso de incremental, basta executar o count(*) na tabela intermediária que contém as linhas modificadas desde a carga anterior.

OSRMDistanceDbOperator dá deadlock no SQL Server

Ao usar o OSRMDistanceDbOperator com o banco de dados Microsoft SQL Server, a primeira query UPDATE fica travada esperando algo em deadlock, por causa da query SELECT que vem antes.

Segundo o @lucasbenevides, se usarmos WITH (NOLOCK) na query SELECT podemos evitar o problema.

sync_db_2_db todos reminders on docstring

  • Automate the creation of the twin table and removal at the end
  • Turn into an Airflow Operator
  • Allow reading from MsSql and writing to Postgres
  • Allow inserting load date into the destination table
  • Create tests

Remove personal info in bacen_STA_hook

In file bacen_sta_hook, the content of the email after a updated password contains fixed personal login information. Needs to change it to get dynamically from Airflow Connections;

Attempt to write an empty patch gives confusing error

In the patchtowrk module, if the quality control dataframe is empty and someone calls DataPatch.to_file, the method fails with a confusing message:

KeyError: "None of [Index(['nan'], dtype='object', name='key_name')] are in the [index]"

It should instead fail with a clear and useful error message.

Add a build container step for tests

The test container fails to setup (make setup) on Github Actions because Airflow is not ready when it runs airflow db reset.

A proposed solution is to build a new container inheriting from the Airflow container that add the airflow db init step before the setup phase.

Remover biblioteca oauth2client

A biblioteca oauth2client foi acrescentada no ambiente pois o GSheetHook a importa diretamente (até então estava sendo instalada pela versão antiga da pygsheets==2.0.3,1). Porém esta versão está depreciada e foi removida da pygsheets. Remover todos os usos que importam oauth2client e substituir pela alternativa atual.

Criar Operator que extrai dados do banco mantendo os tipos

O DownloadCSVFromDbOperator salva a tabela em formato csv, que não preserva os tipos das colunas. Por exemplo, se no banco uma coluna é do tipo VARCHAR, mas os dados são numéricos, ao salvar em csv e ler com o Pandas, este vai interpretar como Int64 ou float.

Precisamos de um outro Operator ou um parâmetro no DownloadCSVFromDbOperator que possibilite extrair uma tabela preservando os tipos das colunas.

Error on create_table_if_not_exists

When using the DbtoDpOperator to copy a table to a non-existing destination table, the create_table_if_not_exists command creates only the table but misses the columns, resulting in an error. This scenario occurred with the following table from Quartzo: cipiws_VBL.arquivo_intervencao. The table was created in the data lake but without any columns.

Adjust create_table function for Teiid sources.

Adjust function create_table_if_not_exists for Teiid (Quartzo) sources. By now this function only works when the source connection provider of the database is PostgreSQL or SQL Server. This improvement will require a datatype mapping dictionary considering the destination sources can be both SQL Server or Postgres.

Empacotar projeto com Poetry

O empacotamento vai facilitar a instalação do FastETL por outras pessoas (através do pip) e garantir a resolução das dependências de outros pacotes.

Return Trigger Date with Timezone

Update function get_trigger_date to return the datetime with the server timezone configuration, and not UTC. This update is necessary to avoid problems when executing DAGs near the end of the day.

Env Var: AIRFLOW__CORE__DEFAULT_TIMEZONE

Incluir parâmetro `steps` no OSRMHook

O parâmetro steps na API do OSRM determina se será incluída a descrição passo a passo da rota calculada.

Nos casos em que interessa apenas calcular a distância, poupa-se algum tráfego de rede ao não incluir esses passos na resposta json.

Adicionar parâmetro 'since_date' na function sync_db_2_db

Quando tabelas com milhões de linhas recebem carga full, o processamento às vezes demora vários dias para completar. Sendo assim, a última data de referência disponível na tabela para o incremental é a do último dia da carga. Porém, neste caso, a data de referência correta deve ser a do primeiro dia, para que o incremental não descarte alterações realizadas desde o início do full.

Por isso, na function sync_db_2_db, é preciso adicionar um parâmetro opcional since_date que permita especificar esta data de referência. Quando informada, deverá se sobrepor ao resultado obtido na function _build_increm_filter que procura o max(<data-alteração>) da tabela.

Translate README to English

In order to reach an international audience, many things need to be translated to English.

Let's begin with the most obvious: the README.md file. The original text in Portuguese should be moved to LEIAME.md;

Update actions/checkout to v3

Github issues a warning in Actions when we run actions/checkout@v2. It seems that that version is tied to node.js version 12 which is deprecated. Updating to v3 could solve the warning.

Create instructions for receiving contributions

As per good practice in open repositories, this should have contributing guidelines in a CONTRIBUTING file, including:

  • refer to the code of conduct (another document that is good practice, but we don't have it yet)
  • instructions to fork the project and set up a developing environment
  • instructions to follow the expected workflow of contributions (setting up a branch, pushing to your fork, creating a PR, etc.)
  • remind contributors that by submitting a PR they are licensing their contributions with the repository's LICENSE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.