Example #1
0
	def retrieveData(self, id, dataset):
		query = self.api.getDataQuery(id, dataset)
		iquery = InstanceQuery()
		iquery.db_url = "jdbc:mysql://" + self.config.HOST + ":" + str(self.config.PORT) + "/" + self.config.DB
		iquery.user = self.config.USER
		iquery.password = self.config.PASS
		iquery.query = query
		data = iquery.retrieve_instances()
		data.class_is_last()
		return data
 def do_execute(self):
     """
     The actual execution of the actor.
     :return: None if successful, otherwise error message
     :rtype: str
     """
     iquery = InstanceQuery()
     iquery.db_url = str(self.resolve_option("db_url"))
     iquery.user = str(self.resolve_option("user"))
     iquery.password = str(self.resolve_option("password"))
     props = str(self.resolve_option("custom_props"))
     if (len(props) > 0) and os.path.isfile(props):
         iquery.custom_properties = props
     iquery.query = str(self.resolve_option("query"))
     data = iquery.retrieve_instances()
     self._output.append(Token(data))
     return None
 def do_execute(self):
     """
     The actual execution of the actor.
     :return: None if successful, otherwise error message
     :rtype: str
     """
     iquery = InstanceQuery()
     iquery.db_url = str(self.resolve_option("db_url"))
     iquery.user = str(self.resolve_option("user"))
     iquery.password = str(self.resolve_option("password"))
     props = str(self.resolve_option("custom_props"))
     if (len(props) > 0) and os.path.isfile(props):
         iquery.custom_properties = props
     iquery.query = str(self.resolve_option("query"))
     data = iquery.retrieve_instances()
     self._output.append(Token(data))
     return None
def main():
    """
    Just runs some example code.
    NB: You have to fill in the following parameters to make it work with MySQL:
    - HOSTNAME: the database server IP or hostname (or just 'localhost')
    - DBNAME: the name of the database to connect to
    - DBUSER: the user for connecting to the database
    - DBPW: the password for the database user
    - TABLE: the table to retrieve the data from
    And also supply the correct path to the MySQL jar in the "main" method below.
    """

    # retrieve some data
    helper.print_title("Loading data from a database")
    iquery = InstanceQuery()
    iquery.db_url = "jdbc:mysql://HOSTNAME:3306/DBNAME"
    iquery.user = "******"
    iquery.password = "******"
    iquery.query = "select * from TABLE"
    data = iquery.retrieve_instances()
    print(data)
def main():
    """
    Just runs some example code.
    NB: You have to fill in the following parameters to make it work with MySQL:
    - HOSTNAME: the database server IP or hostname (or just 'localhost')
    - DBNAME: the name of the database to connect to
    - DBUSER: the user for connecting to the database
    - DBPW: the password for the database user
    - TABLE: the table to retrieve the data from
    And also supply the correct path to the MySQL jar in the "main" method below.
    """

    # retrieve some data
    helper.print_title("Loading data from a database")
    iquery = InstanceQuery()
    iquery.db_url = "jdbc:mysql://HOSTNAME:3306/DBNAME"
    iquery.user = "******"
    iquery.password = "******"
    iquery.query = "select * from TABLE"
    data = iquery.retrieve_instances()
    print(data)