Uploaded image for project: 'S2Graph'
  1. S2Graph
  2. S2GRAPH-215

Implement a Storage Backend for JDBC driver, such as H2, MySql using the Mutator and Fetcher interfaces.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Done
    • Minor
    • Resolution: Done
    • None
    • None
    • s2core
    • None

    Description

      Implement a Storage Backend for JDBC driver, such as H2, MySql using the Mutator and Fetcher interfaces.

      S2GRAPH-213  The issue has been completed.

      I will try to implement Fetcher and Mutator for JDBC by using the abstract mutation/query function completed in the above issue(S2GRAPH-213).

      Direction of implementation

      • Data sorting and transactions take advantage of the functionality provided by the RDBMS.

      DDL (table, index)

      Assume that the 's2graph' service, the 'user' column, and the 'friends' label are created using the s2graph management function as shown in the example below.

      The label friends has an 'idx_age_score' that uses the age, score properties and (age, score) fields.

          val serviceName = "s2graph"
          val columnName = "user"
          val labelName = "friends"
      
          val service = management.createService(serviceName, "localhost", "s2graph_htable", -1, None).get
          val serviceColumn =
            management.createServiceColumn(serviceName, columnName, "string", Nil)
      
          val label = management.createLabel(
            labelName,
            service.serviceName,
            serviceColumn.columnName,
            serviceColumn.columnType,
            service.serviceName,
            serviceColumn.columnName,
            serviceColumn.columnType,
            service.serviceName,
            Seq(
              Index("idx_age_score", Seq("age", "score"))
            ),
            Seq(
              Prop(name = "score", defaultValue = "0.0", dataType = "double"),
              Prop(name = "age", defaultValue = "0", dataType = "int")
            ),
            isDirected = true,
            consistencyLevel = "strong",
            hTableName = None,
            hTableTTL = None,
            schemaVersion = "v3",
            compressionAlgorithm = "gz",
            options = options,
            initFetcherWithOptions = true
          ).get
      

      In this case, H2 database (mysql mode) for label friends creates the following table.
      Implement a query / mutation that fits the table schema.

        CREATE TABLE `_EDGE_STORE_friends`(
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `_timestamp` TIMESTAMP NOT NULL default CURRENT_TIMESTAMP,
          `_from` varchar(256) NOT NULL,
          `_to` varchar(256) NOT NULL,
          PRIMARY KEY (`id`),
          `age` int(32),
          `score` double,
          KEY `idx_age_score` (`age`, `score`),
          UNIQUE KEY `_from` (`_from`,`_to`),
          UNIQUE KEY `_to` (`_to`,`_from`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              daewon Daewon Jeong
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: