Skip to content

Instantly share code, notes, and snippets.

View zidarsk8's full-sized avatar
🐢

Miha Zidar zidarsk8

🐢
View GitHub Profile
CREATE temporary table if not exists ass_rel_ids as (
SELECT rel.id
FROM assessments AS obj
JOIN relationships AS rel ON (
(rel.source_type="Assessment" AND
rel.source_id=obj.id AND
rel.destination_type NOT IN ("Audit", "Comment", "OrgGroup", "Section", "AccessGroup", "System", "Contract", "DataAsset", "Regulation", "Snapshot", "Threat", "Objective", "Document", "Control", "Product", "Vendor", "Risk", "Facility", "Process", "Clause", "Standard", "Policy", "Person", "Market")) OR
(rel.destination_type="Assessment" AND
rel.destination_id=obj.id AND
rel.source_type NOT IN ("Audit", "Comment", "OrgGroup", "Section", "AccessGroup", "System", "Contract", "DataAsset", "Regulation", "Snapshot", "Threat", "Objective", "Document", "Control", "Product", "Vendor", "Risk", "Facility", "Process", "Clause", "Standard", "Policy", "Person", "Market")))
#!/bin/bash
# Delete all containers
if [ -n "$(docker ps -a -q)" ]; then
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
fi
# Delete all images
-- MySQL dump 10.13 Distrib 5.5.53, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: ggrcdev
-- ------------------------------------------------------
-- Server version 5.5.53-0ubuntu0.14.04.1-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
-------------------- >> begin captured stdout << ---------------------
################################################################################
request data:
[
{
"filters": {
"expression": {
"left": {
"left": {
"left": "child_type",
-------------------- >> begin captured stdout << ---------------------
[
{
"Snapshot": {
"count": 3,
"total": 3,
"values": [
{
"child_id": 26,
"child_type": "Market",
-- MySQL dump 10.13 Distrib 5.5.53, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: ggrcdev
-- ------------------------------------------------------
-- Server version 5.5.53-0ubuntu0.14.04.1-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
object generation WITHOUT hmtl cleanup (0, 1 and 5, object properties) values are 4 character strings (str(number))
generate empty model: Control : 0.062584
generate empty model: Process : 0.227454
generate empty model: Program : 0.193430
generate empty model: AccessGroup : 0.176899
generate empty model: Assessment : 0.153280
generate empty model: Person : 0.153514
generate model with title dict: Control : 0.129530
generate model with title dict: Process : 0.258653
vagrant@4a9f4b8ee0f4 /vagrant
$ python ormtest.py
SQLAlchemy ORM: Total time for 10 records 1.83095216751 secs
SQLAlchemy ORM bulk save objects: Total time for 10 records 1.7470998764 secs
SQLAlchemy Core: Total time for 10 records 1.82306408882 secs
SQLAlchemy Single: Total time for 10 records 0.45939707756 secs
vagrant@4a9f4b8ee0f4 /vagrant
$ python ormtest.py
SQLAlchemy ORM: Total time for 100 records 15.5339519978 secs
SQLAlchemy ORM bulk save objects: Total time for 100 records 15.4684011936 secs
AccessGroup - * * * * * * * * * * * * * * * * * * * * * * * * *
Assessment - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
AssessmentTemplate - * * * * * * * * * * * *
Audit - * * * * * * * * * * * * * * * * * * * *
AuditObject - * * * * * * *
Categorization - * * * * * * *
CategoryBase - * * * * * * * * *
ControlCategory - * * * *
2016-09-22 20:52:26,039 INFO sqlalchemy.engine.base.Engine SELECT programs.id AS programs_id, programs.context_id AS programs_context_id
FROM programs
INFO 2016-09-22 20:52:26,039 sqlalchemy.engine.base.Engine SELECT programs.id AS programs_id, programs.context_id AS programs_context_id
FROM programs
2016-09-22 20:52:26,040 INFO sqlalchemy.engine.base.Engine ()
INFO 2016-09-22 20:52:26,040 sqlalchemy.engine.base.Engine ()