Stoic · @engelbart
33 followers · 239 posts · Server qoto.org

Hello everyone!

In today's post, we'll discuss the data modeling and schema design for our Golang project, which focuses on analyzing a marketplace's purchase data. This analytical application will help us understand the relationships between sellers, products, and customers, as well as feedback provided by customers on their purchases. The marketplace operates in various locations, including countries and states.

Let's dive into the details of the data schema:

Node types:

Location: Represents a country or a state.

Seller: Contains attributes such as name, locations where the seller offers products, and feedback scores.

Product: Includes attributes like ID, price, and a relationship to its seller.

Customer: Has attributes like ID, location, and represents clients who ordered products and optionally provided feedback on their purchases.

Relationships:

Seller to Location: A many-to-many relationship, indicating the locations where a seller offers their products.

Product to Seller: A many-to-one relationship, connecting each product to its respective seller.

Customer to Product: A many-to-many relationship, representing the products purchased by customers.

Customer to Product (Feedback): A many-to-many relationship, where customers can provide feedback on the products they purchased.

With these node types and relationships in place, we can efficiently model our analytical application about marketplace purchases in a graph database. In the following posts, we'll explore different graph databases and evaluate how well they can handle our data model, in terms of installation, code samples, and performance.

Stay tuned for our next post, where we'll dive into EdgeDB and explore its potential for our Golang project. See you there!

```
classDiagram
Location "1" -- "many" Seller : Offers Products In
Seller "1" -- "many" Product : Sells
Customer "many" -- "many" Product : Purchased
Customer "many" -- "many" Product : Gave Feedback On

class Location {
+ID: Integer
+Name: String
}

class Seller {
+ID: Integer
+Name: String
+FeedbackScore: Float
}

class Product {
+ID: Integer
+Price: Float
}

class Customer {
+ID: Integer
+Location: String
}

Purchased --|> Customer
Purchased --|> Product
class Purchased {
+Count: Integer
}

GaveFeedbackOn --|> Customer
GaveFeedbackOn --|> Product
class GaveFeedbackOn {
+Score: Float
}
```

Copy the code above and paste it into the Mermaid Live Editor (mermaid-js.github.io/mermaid-l) or any other Mermaid-compatible diagramming tool to generate the updated schema diagram

#edgedb #golang #graph #schema_design #data_modeling #neo4j #dgraph

Last updated 1 year ago

Stoic · @engelbart
33 followers · 238 posts · Server qoto.org

Hello everyone!

In this blog series, we’re going to explore various graph databases for a Golang project I’m currently working on.

The project requires a cloud-native graph database.

Our use case involves a small schema with a massive amount of data, millions of new edges inserted daily, and sub-second query times for interactive user engagement.
We will talk more about the schema in the next post.

Over the following days, we’ll dive into different graph databases, test installations, code samples, and benchmark results. We’ll kick off our journey with four popular graph databases: EdgeDB, Neo4J, and Dgraph.

Let’s start with a brief overview of our project requirements and the plan for the upcoming blog posts:

Project Requirements:

  • Cloud-native graph database
  • Quite small schema with a huge amount of data
  • Data-intensive for writing, tens million of new edges daily
  • Sub-second query times for reading, interactive user engagement

Approximate plan:

  • Task description and plan (today’s post)
  • Schema discussion and data modeling
  • Diving into EdgeDB
  • Evaluating Neo4J
  • Assessing Dgraph
  • Considering other options.

By the end of the series, we’ll have a deeper understanding of the strengths and weaknesses of each option, and ultimately make an informed decision on the best fit for our Golang project.

Now, I’d love to hear from you! What are your favorite graph databases, and why? If there’s a specific database you’d like us to consider, please let us know in the comments below. I’m open to suggestions and eager to learn from your experiences.

#golang #dgraph #edgedb #neoj4 #graph

Last updated 1 year ago