Questions tagged [relationship]
Questions in this tag typically involve the association that a set of data has with other set(s) of data.
5,585
questions
0
votes
1
answer
27
views
SQLAlchemy add child to an already existing parent: KeyError
I have looked through similar questions on stackoverflow but found no working solution for my particular case. I suspect the problem is on the stage of creating a parent class as I create it without ...
0
votes
1
answer
37
views
.NET Core EF polymorphic one to many relationship between multiple models
I've started learning .NET Core. Now, I've bumped into a problem related to one to many relationship.
I have Buildings and Rooms models. Both store images into images table (Images model).
Here, I'm ...
-1
votes
2
answers
39
views
how to make relationship between to table in laravel?
my database has two table games and teams,
games migration:
$table->unsignedBigInteger('homeTeam');
$table->unsignedBigInteger('awayTeam');
$table->foreign('homeTeam')->references('id')-&...
1
vote
1
answer
17
views
Entity Framework Core not saving all one-to-one relationships on an entity
I have a BankReport entity class with 71 optional, one-to-one relationships. All of the 71 related entities are similar. They all have a PK / FK which is the ID of the parent BankReport.
If I create a ...
0
votes
0
answers
23
views
Is there native functionality within Dataverse to establish multi-table relationships that automatically update?
I'm in the process of creating a Dataverse database for tracking details of my Suppliers, their Products, and the Systems that they are used in.
The functionality that I want is to be able to provide ...
0
votes
0
answers
6
views
Method to see how a variable effect others variable
i've been working for some projects that involving spareparts life-time.
I have tabular data with numeric value.
I want to know if there any way to knowing that how if i changing 1 variable, i want to ...
-1
votes
1
answer
29
views
How to conceptualize in ERD a database that collects information that changes overtime while keeping the old information?
I'm trying to create a database that will keep the information over time.
Meaning that some fields in a table has some information.
Eventually, those fields will need to be updated but the previous ...
0
votes
0
answers
21
views
how to avoid circular import when defining annotated relationship in sqlalchemy2.0
Below is an example used in the official doc:
class Parent(Base):
__tablename__ = "parent_table"
id: Mapped[int] = mapped_column(primary_key=True)
child: Mapped["Child"...
0
votes
2
answers
29
views
Saving issue about relationship with laravel backpack
I have a field in ImageCrud controller.
$this->crud->addField([
'label' => "Etiketler",
'type' => 'select_multiple',
'name' ...
0
votes
0
answers
9
views
PowerBI Applying New Data (New Column) to Old Report - Values go blank
I built a scorecard that dynamically compares two markets to each other - I built it with less data than I knew would go into the report because I figured I could always add more splits in later. This ...
1
vote
1
answer
24
views
Define strength relation pgadmin 4
I'm working on a database with different types of relationships between tables, 1:M and M:N. I've already defined the relationships through foreign keys in PG Admin 4.
When I open the model in QGIS I ...
1
vote
1
answer
36
views
How to correctly access elements through many-to-many relationships?
There is such a data structure in the database
Model Users:
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/*
* Model(Users) with (Group_users)
* ...
0
votes
0
answers
28
views
Power BI - set multiple many to many active relationships between several fields of 2 tables
I'm new to this forum, bear with my little knowledge of programming and power BI please!
I'm also not a native english speaker, let me know if something seems hard to understand.
My problem is the ...
1
vote
1
answer
27
views
how to access relations of laravel factory from inside another factory
I have a model called Company, and Fields are added to it via an observer after it is created:
protected static function booted(): void
{
static::created(function (Company $company) {
...
0
votes
0
answers
44
views
Perform a calculation using columns located in tables linked by successive relationships
Model Overview
dSystème : Existence of a set of systems on which employees are working
fCompétencePersonne : Employee competence has been evaluated (NivCompétence) for each system
fIplanning : An ...
0
votes
0
answers
17
views
creating new relationship to a a resource in json api
I have room resource and inside room there are multiple features which are reference to this room. i am using subrequest to make changes to it but it does modify the relationships. here is my code:
...
0
votes
0
answers
26
views
Relationship returns null for some records - Laravel
I have 2 models: TopHistory and User I using UUID for id column in User table, and user_id column in TopHistory. In TopHistory model. I have create a relationship method.
public function user() {
...
0
votes
0
answers
8
views
Core Data One to Many Relationship - How to save NSSet values?
I'd like to store the values in a NSSet atribute in core data. The code is compiling, but I miss something that I can't see. I have to get some activities to be attached to the travel. One travel has ...
0
votes
0
answers
22
views
"org.hibernate.HibernateException: collection was evicted" spring 2.7.13 error
I am trying to get an individual recipe with its respestive categories, using id. I am currently facing the following error, org.hibernate.HibernateException: collection was evicted. My understanding ...
-2
votes
0
answers
8
views
Database and ERD
What is the difference between Database diagram and Entity relationship diagram?
If we use crow's foot notation then both are same or both are different from each other? I'm student and currently ...
0
votes
1
answer
20
views
Relation programmingError
I have model code for which migrations have successfully created and passed:
from django.db import models
from django.contrib.auth.models import AbstractUser
class Employee(AbstractUser):
...
0
votes
0
answers
77
views
How do I create a inverse relationship in SwiftData to the same model class?
How do I create an inverse relationship that is required for CloudKit when the model has a reference to other objects of the same model? As an example I have an employee that is of type Person who has ...
0
votes
0
answers
10
views
PowerBI - Referenced Table Column Slicer Not Filtering Other Referenced Table or Parent Table Visuals
I have a parent table appended from 2 tables pulled in using API links. For the purpose of data tranformation I have to reference tables and transform data before visualization for some visuals (while ...
0
votes
0
answers
27
views
Forced to have 2 of the same filter on different tables in power BI
I am making a dashboard of staffing cost per FTEs. I have pulled in 2 SQL queries, one for FTEs and one for Salaries. I am trying to filter down on an individual employee. I have to have 2 of the same ...
0
votes
1
answer
29
views
I want to fetch lazy my user entity but it not work
I have my Entity
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@JsonIgnoreProperties(value = { "createdBy", "createdDate", "lastModifiedBy", "...
0
votes
0
answers
27
views
Mongodb one to many relation load in nestjs
I have found many questions asking sort of the same thing but I can't figure out what I am missing. As the title says I am trying to load a one-to-many relationship with NestJS from a MongoDB entity.
...
0
votes
0
answers
119
views
Swiftdata three level relationship not working in SwiftUI preview
There is a 3 level relationship in my model:
Parent(One) -> Child(Many) -> GrandChild(Many)
The way it is set up is working fine in the simulator, but the preview crashes when adding code to ...
0
votes
0
answers
16
views
How to model 2 tables recursive relation in Prisma or raw Postrgres
I got a problem to do my data model on a quite tricky relationship that I had not seen until now :
I have two entities : templates and variables.
A Template is a mathematical expression which can ...
0
votes
1
answer
38
views
using relationship and inheritance in roomdatabase
I'm trying to create a simple e-wallet app and I want to save the details of each change of the account balance along with the current balance right after any transaction. I want to save these ...
0
votes
2
answers
47
views
Is there any way to get values from an unrelated table?
enter image description hereI am new to Power BI. I have a data model which contains two fact tables i.e. SALES and RETURNS. I have some dimension tables like CALENDAR, PRODUCTS, CUSTOMERS etc. My ...
0
votes
1
answer
44
views
Laravel: How to get nested relationships from two parents
I am having trouble articulating my Laravel question, so please bear with me while I try to explain my problem.
I am trying to make a web interface where users can create one or more copies of a page ...
1
vote
1
answer
35
views
How to insert condition in Laravel One-to-one table relation?
I have a this method in a Laravel Controller that retrieves all records from the Contact table:
public function handle(Request $request) {
$tasks = ContactTask::with([
'...
1
vote
1
answer
39
views
Best way to handle circular dependencies in production
What is the common practice or best way to handle circular dependencies in a newly deployed database?
Let's say I have a new database ready to be deployed in production. What is the best way or common ...
0
votes
3
answers
70
views
How to get a single field from a Laravel whenLoaded resource
I am using a Laravel Resource to return my object. The object has optional relationships. My Resource code so far is below and is working as expected:
public function toArray(Request $request): array
{...
1
vote
1
answer
43
views
Relate rows based on one or two fields
I am open to solutions using Python, PowerBI, and/or Excel/VBA for this.
I have a dataset full of addresses and names. A name can be related to many addresses and there can be many names related to an ...
0
votes
1
answer
39
views
Handling Many-to-Many Relationship Duplicates in Power BI Visualization
Good morning, I wanted to create a visualization in Power BI between two tables, "FMapa" and "DRegiaoAdministrativa," using the columns RA (Administrative Region) and Bairro (...
-1
votes
1
answer
38
views
Why not always use One-to-Many instead of Many-to-Many?
I'm trying to learn about postgres and relationships. So let's take a very common example. Say we have a Users table and a Products table. I know that the classic way to go about it is to phrase the ...
1
vote
1
answer
49
views
Laravel Eloquent Multiple whereHas with Where condition
I have models Term, Concept, and Expression. I have pivot tables concept_expression and concept_term.
Schema
terms table
id
term,
concepts table
id
expressions table
id
expression_plural
...
0
votes
0
answers
29
views
Updating navigation property for multiple entities at once in .NET Core & EF Core
I have a relationship that is set up as fully defined which I am having trouble with when updating multiple navigation properties
Parent:
class Parent
{
// ...
public List<ParentItem> ...
0
votes
1
answer
29
views
Laravel | Fetch query results by matching multiple where conditions on multiple columns
I have two tables , users and user_skills Schema Design. Each user can have multiple skills where there are experience in number of years associated with each skills .
users
id
name
email
age
1
A
a@...
0
votes
0
answers
54
views
How to create database-like relations between Python objects
Say I have a type of object Foo and another called Bar. Say Foos can "have" 0 or more Bars, and that all Bars must have a single Foo. Something like this doesn't feel right because there's ...
0
votes
1
answer
27
views
Is my Team Lead right about FKs in a MySQL DB?
TLDR:
Is not declaring a row in a table that relates to another table as a foreign key good practice in mysql?
Long story:
Today at a project meeting about the design of the mysql db I was presenting ...
0
votes
1
answer
23
views
What is the correct Laravel relationship to connect actors, categories and tags to videos?
I have a Videos table where each video can be assigned multiple actors, and each actor can be in multiple videos.
I have a tags table where each video can be assigned multiple tags, each tag in ...
0
votes
1
answer
39
views
Laravel eloquent relationship function name
I have 2 table, which is posts and categories. The relationship between posts and categories is many to one. So the code in post class model is like this :
<?php
namespace App\Models;
use ...
0
votes
1
answer
121
views
How to model a soft enum using a backing table
I have an existing pair of tables, unfortunately I can't change anything about them since they come from a different application and at least for the forseeable future that application still has to ...
0
votes
0
answers
14
views
One-to-One or Many-to-One Association
Why in the Doctrine Doc first comment is a Many-to-One relationship?
https://www.doctrine-project.org/projects/doctrine-orm/en/2.15/reference/working-with-associations.html
class User
{
/** ...
2
votes
1
answer
41
views
Laravel Eloquent: Complex Many-to-Many Relationship with Default Values for Missing Relations
I'm facing a complex problem in Laravel concerning Eloquent relationships. I'd appreciate any assistance you can provide.
Here's the structure of my tables:
Tables:
albums: id, name
photos: id, name
...
0
votes
1
answer
26
views
Verify the type of relations of knowleage base like Symmetric, Transitive
Recently, I've been working on building a dataset. I have downloaded some open-source datasets like YAGO, and my next step is to determine whether the relationships in these datasets have certain ...
0
votes
0
answers
21
views
Laravel Relationships: Users - Morph Many Through?
I am trying to get all users that belong to two models.
I have Bursary Administrators who can have many Students and then Users who are normal Bursary Administrator users or Student users.
I am trying ...
0
votes
0
answers
16
views
Eloquent filter products through belongTo by morph model
I need to filter Products by pivot table through belongsTo relationship
model Product
'name',
'base_unit',
];
public function baseUnit()
{
return $this
...