<jupyter_start><jupyter_text>Initial `CREATE TABLE` commands for data of `QUANDL`<jupyter_code>import pymysql
from yitian.datasource import *

# Set up cloud sql connections password
password = ''<jupyter_output><empty_output><jupyter_text>Create `opec_ref_basket` table<jupyter_code>database = COMMODITY
connection = pymysql.connect(host=PRIVATE_HOST,
                             user=USER,
                             password=password,
                             db=database)


# SQL statements
sql = """
        CREATE TABLE IF NOT EXISTS opec_ref_basket(
            date DATE NOT NULL,
            value FLOAT NOT NULL,
        PRIMARY KEY(date));
"""

with connection.cursor() as cursor:    
    cursor.execute(sql)
    connection.commit()
cursor.close()
connection.close()<jupyter_output><empty_output><jupyter_text>Create `nasdaq_xqc`, `nasdaq_xndxt25` and `nasdaq_xndxt25nnr` tables<jupyter_code>database = EQUITY
connection = pymysql.connect(host=PRIVATE_HOST,
                             user=USER,
                             password=password,
                             db=database)


# SQL statements
sql_1 = """
        CREATE TABLE IF NOT EXISTS nasdaq_xqc(
            trade_date DATE NOT NULL,
            index_value FLOAT NOT NULL,
            high FLOAT NOT NULL,
            low FLOAT NOT NULL,
            total_market_value FLOAT NOT NULL,
            dividend_market_value FLOAT NOT NULL,
        PRIMARY KEY(trade_date));
"""

sql_2 = """
        CREATE TABLE IF NOT EXISTS nasdaq_xndxt25(
            trade_date DATE NOT NULL,
            index_value FLOAT NOT NULL,
            high FLOAT NOT NULL,
            low FLOAT NOT NULL,
            total_market_value FLOAT NOT NULL,
            dividend_market_value FLOAT NOT NULL,
        PRIMARY KEY(trade_date));
"""

sql_3 = """
        CREATE TABLE IF NOT EXISTS nasdaq_xndxt25nnr(
            trade_date DATE NOT NULL,
            index_value FLOAT NOT NULL,
            high FLOAT NOT NULL,
            low FLOAT NOT NULL,
            total_market_value FLOAT NOT NULL,
            dividend_market_value FLOAT NOT NULL,
        PRIMARY KEY(trade_date));
"""

with connection.cursor() as cursor:    
    cursor.execute(sql_1)
    cursor.execute(sql_2)
    cursor.execute(sql_3)
    connection.commit()
cursor.close()
connection.close()<jupyter_output><empty_output><jupyter_text>Create `fed_svenpy`, `fed_sveny` and `fed_tipsy` tables<jupyter_code>database = INTEREST_RATE_AND_FIXED_INCOME
connection = pymysql.connect(host=PRIVATE_HOST,
                             user=USER,
                             password=password,
                             db=database)


# SQL statements
sql_1 = """
        CREATE TABLE IF NOT EXISTS fed_svenpy(
            date DATE NOT NULL,
            sevenpy01 FLOAT NOT NULL,
            sevenpy02 FLOAT NOT NULL,
            sevenpy03 FLOAT NOT NULL,
            sevenpy04 FLOAT NOT NULL,
            sevenpy05 FLOAT NOT NULL,
            sevenpy06 FLOAT NOT NULL,
            sevenpy07 FLOAT NOT NULL,
            sevenpy08 FLOAT NOT NULL,
            sevenpy09 FLOAT NOT NULL,
            sevenpy10 FLOAT NOT NULL,
            sevenpy11 FLOAT NOT NULL,
            sevenpy12 FLOAT NOT NULL,
            sevenpy13 FLOAT NOT NULL,
            sevenpy14 FLOAT NOT NULL,
            sevenpy15 FLOAT NOT NULL,
            sevenpy16 FLOAT NOT NULL,
            sevenpy17 FLOAT NOT NULL,
            sevenpy18 FLOAT NOT NULL,
            sevenpy19 FLOAT NOT NULL,
            sevenpy20 FLOAT NOT NULL,
            sevenpy21 FLOAT NOT NULL,
            sevenpy22 FLOAT NOT NULL,
            sevenpy23 FLOAT NOT NULL,
            sevenpy24 FLOAT NOT NULL,
            sevenpy25 FLOAT NOT NULL,
            sevenpy26 FLOAT NOT NULL,
            sevenpy27 FLOAT NOT NULL,
            sevenpy28 FLOAT NOT NULL,
            sevenpy29 FLOAT NOT NULL,
            sevenpy30 FLOAT NOT NULL,
        PRIMARY KEY(date));
"""

sql_2 = """
        CREATE TABLE IF NOT EXISTS fed_sveny(
            date DATE NOT NULL,
            seveny01 FLOAT NOT NULL,
            seveny02 FLOAT NOT NULL,
            seveny03 FLOAT NOT NULL,
            seveny04 FLOAT NOT NULL,
            seveny05 FLOAT NOT NULL,
            seveny06 FLOAT NOT NULL,
            seveny07 FLOAT NOT NULL,
            seveny08 FLOAT NOT NULL,
            seveny09 FLOAT NOT NULL,
            seveny10 FLOAT NOT NULL,
            seveny11 FLOAT NOT NULL,
            seveny12 FLOAT NOT NULL,
            seveny13 FLOAT NOT NULL,
            seveny14 FLOAT NOT NULL,
            seveny15 FLOAT NOT NULL,
            seveny16 FLOAT NOT NULL,
            seveny17 FLOAT NOT NULL,
            seveny18 FLOAT NOT NULL,
            seveny19 FLOAT NOT NULL,
            seveny20 FLOAT NOT NULL,
            seveny21 FLOAT NOT NULL,
            seveny22 FLOAT NOT NULL,
            seveny23 FLOAT NOT NULL,
            seveny24 FLOAT NOT NULL,
            seveny25 FLOAT NOT NULL,
            seveny26 FLOAT NOT NULL,
            seveny27 FLOAT NOT NULL,
            seveny28 FLOAT NOT NULL,
            seveny29 FLOAT NOT NULL,
            seveny30 FLOAT NOT NULL,
        PRIMARY KEY(date));
"""

sql_3 = """
        CREATE TABLE IF NOT EXISTS fed_tipsy(
            date DATE NOT NULL,
            tipsy02 FLOAT NOT NULL,
            tipsy03 FLOAT NOT NULL,
            tipsy04 FLOAT NOT NULL,
            tipsy05 FLOAT NOT NULL,
            tipsy06 FLOAT NOT NULL,
            tipsy07 FLOAT NOT NULL,
            tipsy08 FLOAT NOT NULL,
            tipsy09 FLOAT NOT NULL,
            tipsy10 FLOAT NOT NULL,
            tipsy11 FLOAT NOT NULL,
            tipsy12 FLOAT NOT NULL,
            tipsy13 FLOAT NOT NULL,
            tipsy14 FLOAT NOT NULL,
            tipsy15 FLOAT NOT NULL,
            tipsy16 FLOAT NOT NULL,
            tipsy17 FLOAT NOT NULL,
            tipsy18 FLOAT NOT NULL,
            tipsy19 FLOAT NOT NULL,
            tipsy20 FLOAT NOT NULL,
            
            tipspy02 FLOAT NOT NULL,
            tipspy03 FLOAT NOT NULL,
            tipspy04 FLOAT NOT NULL,
            tipspy05 FLOAT NOT NULL,
            tipspy06 FLOAT NOT NULL,
            tipspy07 FLOAT NOT NULL,
            tipspy08 FLOAT NOT NULL,
            tipspy09 FLOAT NOT NULL,
            tipspy10 FLOAT NOT NULL,
            tipspy11 FLOAT NOT NULL,
            tipspy12 FLOAT NOT NULL,
            tipspy13 FLOAT NOT NULL,
            tipspy14 FLOAT NOT NULL,
            tipspy15 FLOAT NOT NULL,
            tipspy16 FLOAT NOT NULL,
            tipspy17 FLOAT NOT NULL,
            tipspy18 FLOAT NOT NULL,
            tipspy19 FLOAT NOT NULL,
            tipspy20 FLOAT NOT NULL,
            
            tipsf02 FLOAT NOT NULL,
            tipsf03 FLOAT NOT NULL,
            tipsf04 FLOAT NOT NULL,
            tipsf05 FLOAT NOT NULL,
            tipsf06 FLOAT NOT NULL,
            tipsf07 FLOAT NOT NULL,
            tipsf08 FLOAT NOT NULL,
            tipsf09 FLOAT NOT NULL,
            tipsf10 FLOAT NOT NULL,
            tipsf11 FLOAT NOT NULL,
            tipsf12 FLOAT NOT NULL,
            tipsf13 FLOAT NOT NULL,
            tipsf14 FLOAT NOT NULL,
            tipsf15 FLOAT NOT NULL,
            tipsf16 FLOAT NOT NULL,
            tipsf17 FLOAT NOT NULL,
            tipsf18 FLOAT NOT NULL,
            tipsf19 FLOAT NOT NULL,
            tipsf20 FLOAT NOT NULL,
            
            tips1f04 FLOAT NOT NULL,
            tips1f09 FLOAT NOT NULL,
            tips5f5 FLOAT NOT NULL,
            
            bkeveny02 FLOAT NOT NULL,
            bkeveny03 FLOAT NOT NULL,
            bkeveny04 FLOAT NOT NULL,
            bkeveny05 FLOAT NOT NULL,
            bkeveny06 FLOAT NOT NULL,
            bkeveny07 FLOAT NOT NULL,
            bkeveny08 FLOAT NOT NULL,
            bkeveny09 FLOAT NOT NULL,
            bkeveny10 FLOAT NOT NULL,
            bkeveny11 FLOAT NOT NULL,
            bkeveny12 FLOAT NOT NULL,
            bkeveny13 FLOAT NOT NULL,
            bkeveny14 FLOAT NOT NULL,
            bkeveny15 FLOAT NOT NULL,
            bkeveny16 FLOAT NOT NULL,
            bkeveny17 FLOAT NOT NULL,
            bkeveny18 FLOAT NOT NULL,
            bkeveny19 FLOAT NOT NULL,
            bkeveny20 FLOAT NOT NULL,
            
            bkeven02 FLOAT NOT NULL,
            bkeven03 FLOAT NOT NULL,
            bkeven04 FLOAT NOT NULL,
            bkeven05 FLOAT NOT NULL,
            bkeven06 FLOAT NOT NULL,
            bkeven07 FLOAT NOT NULL,
            bkeven08 FLOAT NOT NULL,
            bkeven09 FLOAT NOT NULL,
            bkeven10 FLOAT NOT NULL,
            bkeven11 FLOAT NOT NULL,
            bkeven12 FLOAT NOT NULL,
            bkeven13 FLOAT NOT NULL,
            bkeven14 FLOAT NOT NULL,
            bkeven15 FLOAT NOT NULL,
            bkeven16 FLOAT NOT NULL,
            bkeven17 FLOAT NOT NULL,
            bkeven18 FLOAT NOT NULL,
            bkeven19 FLOAT NOT NULL,
            bkeven20 FLOAT NOT NULL,
            
            bkevenf02 FLOAT NOT NULL,
            bkevenf03 FLOAT NOT NULL,
            bkevenf04 FLOAT NOT NULL,
            bkevenf05 FLOAT NOT NULL,
            bkevenf06 FLOAT NOT NULL,
            bkevenf07 FLOAT NOT NULL,
            bkevenf08 FLOAT NOT NULL,
            bkevenf09 FLOAT NOT NULL,
            bkevenf10 FLOAT NOT NULL,
            bkevenf11 FLOAT NOT NULL,
            bkevenf12 FLOAT NOT NULL,
            bkevenf13 FLOAT NOT NULL,
            bkevenf14 FLOAT NOT NULL,
            bkevenf15 FLOAT NOT NULL,
            bkevenf16 FLOAT NOT NULL,
            bkevenf17 FLOAT NOT NULL,
            bkevenf18 FLOAT NOT NULL,
            bkevenf19 FLOAT NOT NULL,
            bkevenf20 FLOAT NOT NULL,
            
            bkeven1f4 FLOAT NOT NULL,
            bkeven1f9 FLOAT NOT NULL,
            bkeven5f5 FLOAT NOT NULL,
            
            beta0 FLOAT NOT NULL,
            beta1 FLOAT NOT NULL,
            beta2 FLOAT NOT NULL,
            beta3 FLOAT NOT NULL,
            
            tau1 FLOAT NOT NULL,
            tau2 FLOAT NOT NULL,
     
        PRIMARY KEY(date));
"""

with connection.cursor() as cursor:    
    cursor.execute(sql_1)
    cursor.execute(sql_2)
    cursor.execute(sql_3)
    connection.commit()
cursor.close()
connection.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.04401597039633849, 'fraction_numerical': 0.037783620605706496, 'mean_word_length': 1.4993915794597226, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '348201', 'license': 'MIT', 'n_tokens_mistral': 3404, 'n_tokens_neox': 3219, 'n_words': 983, 'path': 'notebooks/etl/quandl/create_tables.ipynb', 'repo_name': 'ziranfeng/quandl', 'size': '10269'}