import traceback import MySQLdb from db.engine_factory import ConnectionFactory cur = ConnectionFactory.create_cursor_for_jdk_importer() # neo4j connect # read from mysql def mySQLReader(start, end): # get all-version library cur.execute("select * from jdk_library where library_id >= %s and library_id < %s", (start, end)) lib_sql_data_list = cur.fetchall() for lib_node_mysql_data_index in range(0, len(lib_sql_data_list)): lib_node, library_id = create_library_node_from_mysql(lib_node_mysql_data_index, node1lib, lib_sql_data_list) # get package cur.execute("select * from jdk_package where library_id = %s", (library_id,)) package_sql_data_list = cur.fetchall() for package_node_sql_data_index in range(0, len(package_sql_data_list)): api_package_id, package_node = create_package_node_from_mysql(package_node_sql_data_index, lib_node, package_sql_data_list)
from db.engine_factory import ConnectionFactory, EngineFactory from db.model import KnowledgeTableRowMapRecord, APIEntity from db.model_factory import KnowledgeTableFactory cur = ConnectionFactory.create_cursor_for_android_importer() session = EngineFactory.create_session() def create_package_node(row_data): package_id = row_data[0] package_full_name = row_data[1] package_short_description = row_data[3] package_first_version = row_data[4] package_entity = APIEntity(qualified_name=package_full_name, api_type=APIEntity.API_TYPE_PACKAGE, full_declaration=package_full_name, added_in_version=package_first_version, short_description=package_short_description) return package_entity, package_id def import_all_android_package(): jdk_package_knowledge_table = KnowledgeTableFactory.find_knowledge_table_by_name(session, "androidAPI_support_package") api_knowledge_table = KnowledgeTableFactory.find_knowledge_table_by_name(session, APIEntity.__tablename__) # get all-version library cur.execute("select * from androidAPI_support_package") package_data_list = cur.fetchall() result_tuples = [] for i in range(0, len(package_data_list)):