O mydumper está disponível para instalação pelo homebrew porém podemos tomar o erro de segmentação, e não funciona de nenhuma forma para fazer a importação dos dados para o MySQL, assim a única alternativa é fazer a compilação a partir do código fonte.
sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
No Ubuntu 22.04, ainda não temos como usar o mydumper diretamente, precisamos fazer a compilação a partir do código fonte para poder instalar usando todas as versões de dependências mais novas.
Para fazer a compilação, assumindo que você está usando o Ubuntu 22.04 e o MySQL 8.0.29, faça a instalação de algumas coisinhas:
sudo apt-get install cmake g++ git -y
sudo apt-get install libglib2.0-dev zlib1g-dev libpcre3-dev libssl-dev libzstd-dev -y
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Temos primeiro as projections: | |
// CategoryProjection.java | |
public interface CategoryLoginProjection { | |
String getName(); | |
String getCode(); | |
String getIconPath(); | |
List<SubcategoryLoginProjection> getSubcategories(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# É uma função simples, recebe o status_code, um content, um json_data, e raise_for_status que é alguma exception da própria | |
# lib requests. | |
# Ela cria um Mock, e adiciona o status e o content, e verifica se tem alguma exception para lançar e adiciona e também | |
# se foi passado o json_data e também adiciona como um mock, para quando formos usar algo como: | |
# `response.json()` também conseguirmos. | |
def __response_mock(status=200, content="CONTENT", json_data=None, raise_for_status=None) -> Mock: | |
response = Mock() | |
response.status_code = status | |
response.content = content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Digamos que numa classe você tenta um if que pega os status_codes default disponibilizados pela lib: | |
if res.status_code == requests.codes['ok']: # esse requests é a lib | |
return True | |
# e que você estar mocando (mock) no teste usando uma fixture: | |
@pytest.fixture(scope='function') | |
def requests(): | |
with patch('src.my_class.requests') as requests_mock: | |
# aqui vamos fazer a mágica |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _any(cls): | |
class Any(cls): | |
def __eq__(self, other): | |
return True | |
return Any() | |
# Para usar basta chamar a função: | |
_any(str) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Had to upload a binary file but multer only works with `multipart/form-data` | |
// And NestJS parses the request. So I had to manually upload it. | |
// First in `main.ts` I had to edit the following line: | |
const app = await NestFactory.create(AppModule); | |
// For: | |
const app = await NestFactory.create(AppModule, { bodyParser: false }); |
NewerOlder