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
df = pd.read_csv("./datasets/Wisconsin_breast_prognostic.csv") | |
df.columns = ['radius_mean', 'texture_mean', 'perimeter_mean', 'area_mean', | |
'smoothness_mean', 'compactness_mean', 'concavity_mean', | |
'concave_points_mean', 'symmetry_mean', 'fractal_dimension_mean', | |
'radius_se', 'texture_se', 'perimeter_se', 'area_se', 'smoothness_se', | |
'compactness_se', 'concavity_se', 'concave_points_se', 'symmetry_se', | |
'fractal_dimension_se', 'radius_worst', 'texture_worst', | |
'perimeter_worst', 'area_worst', 'smoothness_worst', | |
'compactness_worst', 'concavity_worst', 'concave_points_worst', |
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
import time | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import sqlalchemy | |
import teradatasql as tdsql | |
import teradataml as tdml | |
tdml.configure.val_install_location = "VAL" |
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
sql = ["""CREATE USER SYSDBA FROM DBC AS PERM=100000000000, SPOOL=40000000000, TEMPORARY=0, PASSWORD=sysdba;""", | |
"""MODIFY USER SYSDBA AS PASSWORD = sysdba;""", | |
"""GRANT SELECT,EXECUTE ON DBC TO SYSDBA WITH GRANT OPTION;""", | |
"""GRANT ALL ON SYSDBA TO SYSDBA WITH GRANT OPTION;""", | |
"""GRANT SELECT ON SYS_CALENDAR TO SYSDBA WITH GRANT OPTION;""", | |
"""GRANT SELECT ON DBC TO PUBLIC;""", | |
"""GRANT ROLE TO SYSDBA WITH GRANT OPTION;""", | |
"""GRANT PROFILE TO SYSDBA WITH GRANT OPTION;""", | |
"""GRANT CREATE FUNCTION ON SYSDBA TO SYSDBA;""", | |
"""GRANT ALTER FUNCTION ON SYSDBA TO SYSDBA;""", |
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
sql = ["""SELECT SUM(MaxPerm)/(1024*1024*1024) FROM DBC.DiskSpaceV;""", | |
"""SELECT sum(maxperm)/(1024*1024*1024) FROM DBC.DiskSpaceV WHERE databasename='dbc';"""] | |
con = tdsql.connect(host=host, user=user, password=pw) | |
for s in sql: | |
cur = con.cursor() | |
cur.execute(s) | |
res = cur.fetchall() | |
print(f"{res[0][0]} GB") |
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
import sqlalchemy | |
import teradatasql as tdsql | |
host = '192.168.xxx.yyy' | |
user = 'dbc' | |
pw = 'dbc' | |
conn = tdsql.connect(host=host, user=user, password=pw) | |
cur = conn.cursor() | |
cur.execute("{fn teradata_nativesql}{fn teradata_autocommit_on}") |
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
import re | |
import uuid | |
import yake | |
import heapq | |
import string | |
import atexit | |
import urllib | |
import random | |
import requests | |
import itertools |
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
from bs4 import BeautifulSoup | |
from bs4.element import Comment | |
import urllib.request | |
def tag_visible(element): | |
if element.parent.name in ['style', 'script', 'head', 'title', 'meta', '[document]']: | |
return False | |
if isinstance(element, Comment): | |
return False | |
return True |
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
from minio import Minio | |
from minio.error import S3Error | |
def make_bucket(endpoint, access_key, secret_key, bucket_name): | |
client = Minio(endpoint=endpoint, access_key=access_key, secret_key=secret_key, secure=False) | |
try: | |
return client.make_bucket(bucket_name) | |
except S3Error as s3e: | |
return s3e |
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 SYSDBA FROM DBC AS PERM=23592E8, SPOOL=11800E8, TEMPORARY=0, PASSWORD=sysdba; | |
MODIFY USER SYSDBA AS PASSWORD = sysdba; | |
GRANT SELECT,EXECUTE ON DBC TO SYSDBA WITH GRANT OPTION; | |
GRANT ALL ON SYSDBA TO SYSDBA WITH GRANT OPTION; | |
GRANT SELECT ON SYS_CALENDAR TO SYSDBA WITH GRANT OPTION; | |
GRANT SELECT ON DBC TO PUBLIC; | |
CREATE DATABASE Tables_Database FROM SYSDBA AS PERM=200E8; | |
CREATE DATABASE General_Views FROM SYSDBA AS PERM=0; | |
CREATE DATABASE Update_Views FROM SYSDBA AS PERM=0; |
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
MODIFY user dbc as PASSWORD = new_password; | |
CREATE USER SYSDBA FROM DBC AS PERM=23592E8, SPOOL=11800E8, TEMPORARY=0, PASSWORD=secret; | |
GRANT SELECT,EXECUTE ON DBC TO SYSDBA WITH GRANT OPTION; | |
GRANT ALL ON SYSDBA TO SYSDBA WITH GRANT OPTION; | |
GRANT SELECT ON SYS_CALENDAR TO SYSDBA WITH GRANT OPTION; | |
GRANT SELECT ON DBC TO PUBLIC; |