# set config current_path = Path(os.path.dirname(os.path.realpath(__file__))) env_path = current_path / "../../.env" load_dotenv(dotenv_path=env_path) environment = os.environ.get("ENVIRONMENT") import helpers config = helpers.get_config(env=environment) # logging log = logging.getLogger("root") custom_logger.setup_logging(env=environment) # database db_config = { "target_db_connection_string": config.get_db_connection_string("target"), "target_schema": config.schemas["public"], "target_db_name": os.environ.get("SIRIUS_DB_NAME"), } def reset_sequences(): tables_dict = table_helpers.get_enabled_table_details() sequence_list = table_helpers.get_sequences_list(tables_dict) reset_all_sequences(sequence_list=sequence_list, db_config=db_config)
import boto3 pp = pprint.PrettyPrinter(indent=4) env_path = current_path / "../../../../.env" shared_path = current_path / "../../../shared" sql_path = shared_path / "sql" sql_path_temp = sql_path / "temp" load_dotenv(dotenv_path=env_path) environment = os.environ.get("ENVIRONMENT") config = get_config(environment) # logging log = logging.getLogger("root") custom_logger.setup_logging(env=environment, module_name="validate db") is_staging = False conn_target = None target_schema = None source_schema = config.schemas["pre_transform"] mapping_dict = None def get_mappings(): mappings_to_run = [] allowed_entities = config.allowed_entities( env=os.environ.get("ENVIRONMENT")) all_mappings = { "clients": [
try: import os import logging from custom_logger import setup_logging except ImportError as err: logging.exception(err) raise except Exception as err: logging.exception(err) raise else: main_file = os.path.basename(__file__).strip(".py") os.environ["MAIN_SEND_MESSAGE_FILE"] = main_file logger = setup_logging(main_file) try: from send_support import * import subprocess import rospy from subprocess import PIPE from time import sleep except ImportError as err: logger.exception(err) raise except Exception as err: logger.exception(err) raise
logger.info("Hash for %s is %s and seems to be incorrect" % check_str, sum_hash(check_str)) return False check_str = "0090" if (sum_hash(check_str) != "9"): logger.info("Hash for %s is %s and seems to be incorrect" % check_str, sum_hash(check_str)) return False check_str = "1099" if (sum_hash(check_str) != "9"): logger.info("Hash for %s is %s and seems to be incorrect" % check_str, sum_hash(check_str)) return False check_str = "1699" if (sum_hash(check_str) != "5"): logger.info("Hash for %s is %s and seems to be incorrect" % check_str, sum_hash(check_str)) return False else: return True if __name__ == "__main__": from custom_logger import setup_logging logger = setup_logging("test_send_message") test_sum_hash()
# database db_config = { "db_connection_string": config.get_db_connection_string("migration"), "sirius_db_connection_string": config.get_db_connection_string("target"), "source_schema": config.schemas["post_transform"], "target_schema": config.schemas["integration"], "sirius_schema": config.schemas["public"], "chunk_size": config.DEFAULT_CHUNK_SIZE, } target_db_engine = create_engine(db_config["db_connection_string"]) # logging log = logging.getLogger("root") custom_logger.setup_logging( env=environment, db_config=db_config, module_name="business rules" ) @click.command() @click.option("--team", default="") @click.option( "--clear", prompt=False, default=False, help="Clear existing database tables: True or False", ) def main(clear, team): allowed_entities = config.allowed_entities(env=os.environ.get("ENVIRONMENT")) log.info(