Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
2.4 kB
0
Indexable
Never
 def insert_regin_data:
         parameters =(None ,region_name ,region_name)
         "insert_region_sql": "INSERT INTO regions (region_id , region_long_name) VALUES ( %s , %s ) ON DUPLICATE KEY UPDATE region_long_name = %s"
    def insert_os_data:
        parameters = (None , operating_system_name , operating_system_name)
        "insert_os_sql": "INSERT INTO operating_systems (operating_system_id    , operating_system_name) VALUES (%s , %s) ON DUPLICATE KEY UPDATE operating_system_name = %s"
    def insert_vcpu_data:
        parameters= (None ,vcpu_cores_count , vcpu_cores_count)
        "insert_vcpu_sql": "INSERT INTO vcpu_cores (vcpu_core_id , core_count) VALUES (%s , %s) ON DUPLICATE KEY UPDATE core_count = %s"
    def select_regin_data:
        parameters =(region_name)
        "select_region_sql": "SELECT region_id FROM regions WHERE region_long_name = %s"
    def select_os_data:
        parameters = (operating_system_name)
        "select_os_sql": "SELECT operating_system_id FROM operating_systems WHERE operating_system_name = %s ORDER BY operating_system_id DESC LIMIT 1"
   def select_vcpu_sql:
       parameters = (vcpu_cores_count)
       "select_vcpu_sql": "SELECT vcpu_core_id FROM vcpu_cores WHERE core_count = %s"
   def insert_instance_data:
       parameters = (None , None , memory ,storage ,network_performance ,None , instance_name , None , memory , storage ,network_performance , None ,instance_name )
        "insert_instance_sql": "INSERT INTO ec2_instances (instance_id , vcpu_core_id, memory, storage, network_performance, operating_system_id, instance_name) VALUES (%s , %s, %s , %s , %s , %s, %s) ON DUPLICATE KEY UPDATE vcpu_core_id = %s, memory = %s , storage = %s , network_performanc = %s, operating_system_id = %s , instance_name = %s " 
 def select_instance_data:
       parameters = (instance_name)
       "select_instance_sql": "SELECT instance_id FROM ec2_instances WHERE instance_name = %s"
  def insert_region_instance_data:
     parameters = (None , None , price , None , None , price )
      "insert_region_instance_sql": "INSERT INTO region_instances (instance_id , region_id, price_per_hour) VALUES (%s , %s, %s) ON DUPLICATE KEY UPDATE region_id = %s , instance_id = %s, price_per_hour = %s"
   def select_data:
       data_parameters = (instance_name)
       select_data("SELECT instance_id FROM ec2_instances WHERE instance_name = %s", conn, parameters)