Dump existing data:
python3 manage.py dumpdata > datadump.json
Change settings.py to Postgres backend.
Make sure you can connect on PostgreSQL. Then:
#!/bin/bash | |
# Stop all containers | |
docker stop $(docker ps -a -q) | |
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images | |
docker rmi $(docker images -q) |
#!/bin/bash | |
shopt -s nullglob | |
declare -a jsons | |
jsons=(*.json) # ${jsons[@]} - в переменной jsons теперь список всех файлов | |
echo '[' > combined.json | |
if [ ${#jsons[@]} -gt 0 ]; then # проверяем что список не пустой | |
cat "${jsons[0]}" >> manifest.json # первый файл в файл выхода | |
unset jsons[0] # и убираем из спика | |
for f in "${jsons[@]}"; do # и циклом по оставшимся |
#!/usr/bin/env python | |
""" | |
Insert data into HBase with a Python script. | |
To create the table, first use the hbase shell. We are going to create a | |
namespace called "sample_data". The table for this script is called "rfic", | |
as we will be inserting Request for Information Cases from the City of | |
Indianapolis. |
#!/usr/bin/env python | |
import logging | |
import random | |
import time | |
import happybase | |
logging.basicConfig() | |
logger = logging.getLogger() |
domain_regex = r'(([\da-zA-Z])([_\w-]{,62})\.){,127}(([\da-zA-Z])[_\w-]{,61})?([\da-zA-Z]\.((xn\-\-[a-zA-Z\d]+)|([a-zA-Z\d]{2,})))' | |
#Python | |
domain_regex = '{0}$'.format(domain_regex) | |
valid_domain_name_regex = re.compile(domain_regex, re.IGNORECASE) | |
self.domain_name = self.domain_name.lower().strip().encode('ascii') | |
if re.match(valid_domain_name_regex, self.domain_name ): | |
return True | |
else: | |
return False |