This file contains 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
pip install cherrypy | |
nohup python server.py 2>&1 > app.log & |
This file contains 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
@db_url= | |
@user=admin | |
@password= | |
# CREATE Books | |
PUT https://{{db_url}}/ords/admin/soda/latest/books | |
Authorization: Basic {{user}}:{{password}} | |
### |
This file contains 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
DROP USER APP CASCADE; |
This file contains 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
BEGIN | |
DBMS_REDACT.ADD_POLICY( | |
OBJECT_SCHEMA => 'APP', | |
OBJECT_NAME => 'USERS', | |
COLUMN_NAME => 'CARD_NUMBER', | |
POLICY_NAME => 'mask_user_card_nums', | |
FUNCTION_TYPE => DBMS_REDACT.PARTIAL, | |
FUNCTION_PARAMETERS => DBMS_REDACT.REDACT_CCN16_F12, | |
EXPRESSION => '1=1' | |
); |
This file contains 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
CREATE USER APP IDENTIFIED BY "Str0nP4ssw0rd!"; | |
GRANT CONNECT, RESOURCE TO APP; | |
GRANT UNLIMITED TABLESPACE TO APP; | |
CREATE TABLE APP.USERS ( | |
ID NUMBER | |
GENERATED BY DEFAULT ON NULL AS IDENTITY, | |
NAME VARCHAR2(25), | |
CARD_NUMBER VARCHAR2(25) | |
); |
This file contains 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
SELECT | |
BRANCH_NAME, | |
ROUND(SDO_NN_DISTANCE(1), 2) DISTANCE_KM | |
FROM | |
BRANCHES B, | |
WAREHOUSES W | |
WHERE W.WAREHOUSE_NAME = 'Odessa Warehouse' | |
AND SDO_NN(B.GEOMETRY, W.GEOMETRY, 'sdo_num_res=5 unit=km', 1) = 'TRUE' | |
ORDER BY DISTANCE_KM; |
This file contains 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
INSERT INTO USER_SDO_GEOM_METADATA VALUES ('WAREHOUSES', 'GEOMETRY', | |
SDO_DIM_ARRAY( | |
SDO_DIM_ELEMENT('x', -180, 180, 0.05), | |
SDO_DIM_ELEMENT('y', -90, 90, 0.05) | |
), | |
4326 -- Code for Latitude/Longitude coordinate | |
); | |
INSERT INTO USER_SDO_GEOM_METADATA VALUES ('BRANCHES', 'GEOMETRY', | |
SDO_DIM_ARRAY( |
This file contains 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
ALTER TABLE WAREHOUSES ADD (GEOMETRY SDO_GEOMETRY); | |
ALTER TABLE BRANCHES ADD (GEOMETRY SDO_GEOMETRY); | |
UPDATE WAREHOUSES SET | |
GEOMETRY = SDO_GEOMETRY(2001, 4326, SDO_POINT_TYPE(LON, LAT, NULL), NULL, NULL); | |
UPDATE BRANCHES SET | |
GEOMETRY = SDO_GEOMETRY(2001, 4326, SDO_POINT_TYPE(LON, LAT, NULL), NULL, NULL); |
This file contains 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
DROP TABLE BRANCHES; | |
DROP TABLE WAREHOUSES; | |
DELETE FROM USER_SDO_GEOM_METADATA; |
This file contains 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
CREATE TABLE WAREHOUSES (WAREHOUSE_NAME VARCHAR2(30), LAT NUMBER, LON NUMBER); | |
CREATE TABLE BRANCHES (BRANCH_NAME VARCHAR2(30),ZIPCODE VARCHAR2(5), LAT NUMBER, LON NUMBER, BRANCH_TYPE VARCHAR2(30)); | |
INSERT INTO WAREHOUSES VALUES ('Amarillo Warehouse',35.532226,-101.557617); | |
INSERT INTO WAREHOUSES VALUES ('Odessa Warehouse',31.334871,-102.062988); | |
INSERT INTO WAREHOUSES VALUES ('San Antonio Warehouse',29.496987,-98.833007); | |
INSERT INTO WAREHOUSES VALUES ('Waco Warehouse',31.27855,-97.097167); | |
INSERT INTO BRANCHES VALUES('Marshall Branch','75672',32.50555,-94.35579,'WHOLESALE'); | |
INSERT INTO BRANCHES VALUES('Eagle Pass Branch','78852',28.6865,-100.47394,'RETAIL'); | |
INSERT INTO BRANCHES VALUES('Cleburne Branch','76033',32.42166,-97.38356,'WHOLESALE'); | |
INSERT INTO BRANCHES VALUES('Paris Branch','75460',33.66771,-95.5678,'RETAIL'); |
NewerOlder