862
questions
1
vote
0
answers
30
views
Association rule on incident/event relations in Python
I have two sets of data : a list of events and a list of solved incidents with the event that caused each of them. How can I train a model to predict which event caused a new incident to occur?
For ...
0
votes
1
answer
63
views
Request association table attribute (SQLAlchemy) from Strawberry (GraphQL)
I have two db models 'Lab' (list of the labs) and 'File' (list of the uploaded files). I had to create a an association table which shows One-To-Many relationship between them 'LabFile'.
Everything ...
1
vote
1
answer
36
views
Unpermitted Parameter error in Rails for nested nested form submission
I'm trying to create a quiz builder where a user builds a quiz that is added to the Quiz model, a question that is in the QuizQuestions model and answer choices in and AnswerChoices model.
The Quiz is ...
0
votes
0
answers
25
views
apply apriori on it by using data generator but how can I print results
Here is my code for my large dataset with more than 400000 rows and 18 columns.
def data_generator(df):
"""
Data generator, needs to return a generator to be called several times.
...
0
votes
0
answers
46
views
Accessing a Match record, which belongs to a Run record, which belongs to a User record
I am trying to set up a little Rails app where the intention is basically to pair runners together that want to go on a run at a similar date/time, with a similar distance and pace. So far my app has ...
0
votes
1
answer
47
views
Ruby on Rails: How do you create a `has_one` relationship with duplicating primary keys?
I have 2 Tables:
Dogs
- id (primary key)
Cats
- id (primary key)
I would like to introduce a third table let's say Collars, that both dogs and cats have:
Collars:
- id (primary key)
- size
...
0
votes
0
answers
109
views
SQLAlchemy - Association Table Relationship
I have the following tables: Workstation and Parameters.
I want to associate the Workstation with the Parameters, using a WorkstationParameter table that also contains the value of the parameter, ...
1
vote
1
answer
312
views
Rails Active Storage unable to find a valid model association
I hope you are doing good.
I am trying to do is shift paper clip functionality to active storage but I am facing this issue for the past two days but unable to find a solution for it. Maybe you can ...
0
votes
0
answers
133
views
Association Rules with Orange3 using table of orders/bills - How to convert into: cloumns is Items_name, Row is OrderID for associate?
I have a table of orders where we have many of orders, each order is an item. And in excel, you have 2 columns: OrderID and ItemName. So if u have 4 items in one order, you will have 4 row have the ...
0
votes
1
answer
198
views
Using Ransack with last child record search
I have a parent with many children. I am interested in searching a column on the last (highest ID) child record.
I have seen a reference to a "_last" association syntax in Ransack, and it is ...
0
votes
1
answer
380
views
How to do a sequelize association model BelongsToMany?
I am trying to associate in the middle table two models with M:N (User.ts and List.ts). In this case I am using typescript-sequelize package to make the models and in the documentation for the package ...
0
votes
1
answer
199
views
sequelize-typescript HasMany association throw error
I am tring to give the Table User multiple associations, I made one already with @BelongsToMany, but if I try to add @HasMany the console throw this error : SequelizeDatabaseError: there is no unique ...
1
vote
1
answer
94
views
Associations without indexing
let's say I have a one to one relationship between two models. I create the relationship has_one and belongs_to in respective classes. Before migrating I connect the two tables using t.references :...
0
votes
2
answers
568
views
sequelize associations do not work, how to associate properly many to many and one to many?
I have a products table and each product has some materials it is made of, the materials are referenced from Materials table, I have only their ids in the product record.
My problem is that that I can'...
0
votes
0
answers
48
views
Problem when declaring an association inside a plugin in Cakephp 4
I'm creating a plugin RubriquesManager in which there are the 2 associated Tables Rubriques and Blocs.
Rubriques hasmany Blocs
Blocs belongsTo Rubriques
When Rubriques and Blocs were not in the ...
2
votes
1
answer
201
views
Mapping UML Association class to Java Model code
I would like to know the proper way to implement UML association class in Java programming code. I have Student and Course classes. Student can attend one or more Courses, Courses can be attended by ...
3
votes
2
answers
232
views
how can i create three child records while updating a parent record in rails?
i have a relation like a teacher can have at max three students. I have a association like teacher has many students and student belongs to teacher. so while updating a teacher record im showing a ...
-2
votes
1
answer
310
views
many-to-many relationship in rails
I have the following models
class Order < ApplicationRecord
has_many :order_details
has_many :products, through: :order_details
end
class OrderDetail < ApplicationRecord
belongs_to :order
...
0
votes
1
answer
82
views
Is this possible to add many relations between two models? Rails 7
I am working with a database like this :link to db UML
All my models are link to User with 'belongs_to' (User have 'has_many').
My Contact and Society models are link to the Project one by a 'has_many:...
0
votes
1
answer
33
views
Rails: Create a form which adds another referencing model
I have a Rating Table which contains a Explanation Field (text). I would like to have one form which creates both entries (in SasRating and in TextContent).
My Code:
Migrates:
class CreateSasRatings &...
2
votes
1
answer
1k
views
Can't use attributes with sequelize.fn inside include block of findAll query
I'm trying to use sum for the data of my relational data model which mean i have billingsummary as a parent model and billingdetails as child model and both are linked with association of many to one ...
0
votes
1
answer
45
views
Can you use "belongs_to' if a model can be associated to multiple owners/parents?
I have a many-to-many relationship between Policy(s) and Rule(s). A policy can have multiple rules. A given rule can belong to multiple policies. There's a mapping table PolicyRule(s) that exists (...
0
votes
1
answer
54
views
ActiveRecord Association - Design Question
Overview
I have a set of data models for a Sailing club example, where there are Members of the club, who have a relationship with a Boat (eg Owner, Skipper, Crew). Currently wrestling with the best ...
0
votes
1
answer
166
views
Duplicate primary keys created in rails models
I am trying to create a chat functionality in my app using Ruby/Rails with React frontend. I am having an issue creating duplicate conversation instances with the same key every time I create a new ...
0
votes
0
answers
27
views
has_many relation on the same source
The User references both the Software Model and it's DAW scope in this example, both relating to the Software model
Whenever i use the below code - every time a user updates their data from the View ...
2
votes
1
answer
241
views
Historical association pattern
I'm currently studying software engineering patterns and one that we've been given to study is the "historical association pattern" It refers to the historical mapping pattern given in ...
0
votes
1
answer
757
views
How to associate table column with another table
So basically I like to know what association i need to link my routes table with employees table. I have a routes table with an employees column (array type) which holds employee id's. I also have an ...
0
votes
1
answer
533
views
Can't update SQLAlchemy association table extra columns
My models look like this:
class Company(DB_BASE):
__tablename__ = 'Company'
id = Column(Integer, primary_key=True, index=True)
...
products = relationship('Product', secondary=...
1
vote
1
answer
1k
views
Sequelize association: associates
Please i'm new to sequelize and I have two models I've been trying to associate. The company_billing models contains several plans of different companies while the visitorsuite_plans contains distinct ...
8
votes
2
answers
8k
views
has_many :through association cannot find a valid model
I am creating association pretty much identical with the Rails Guides Patient-Appointment-Physician data model. A user has many prospects through prospect_subscription. However, when trying to access ...
0
votes
1
answer
98
views
Node sequelize not creating associations
I am unable to create associations with sequelize in nodejs, it's creaing only booking not creating Notes automatically.
here is my code
db.js
async function initialize() {
db.Booking = require(...
0
votes
1
answer
630
views
how to update/create has_one associated data efficiently in rails
Hi i am learning rails and i got the situation where i have to update or create the data for has_one associated model/table.
I tried this
Worker.rb
class Worker < ApplicationRecord
has_one :...
0
votes
1
answer
359
views
Create new record based upon the presence of a record with Rails
I've got a rails app that has two models: address and delivery, where address has_many :deliveries and delivery belongs_to :address.
I'm attempting to create a means by which a single POST request can ...
0
votes
0
answers
64
views
Issue with Association in Ruby on Rails
I have a model called Path and at that model, there is a column which I have split it to four numbers and I want to associate these numbers to two models Termlist_path and Termlist but I get the error ...
-1
votes
2
answers
77
views
Get id of intance Ruby on Rails
I am building an ruby app to book accommodations. So I would to put a form_with in the show action for the model Booking. Model Booking is a connection between is User model and Logement Model. To do ...
0
votes
1
answer
35
views
Rails association getting complex to understand
I am bit old but still new to Rails and in my learning orocess I have got stucked in a point where I can't figure out how can I make association between two entities.
So here is the background of app....
1
vote
1
answer
1k
views
Sequelize: TypeError: hasOne is not a function
Hi I am new to Sequelize the hasOne association is not working for me I am trying to make two tables a table of
Dealer containing a dealer's name and description
DealerProducts containing the Dealers ...
0
votes
0
answers
700
views
Sequelize association between Users, Employees, Customers, Sessions and Roles Table
I am working on my first node application and designing database using Sequelize. I was able to define database structure easily using models but stuck in association phase. I spent decent amount on ...
0
votes
1
answer
858
views
How to load attributes without nested object from associated models in sequelize nodejs
how to return a user object array without any nested object in the array elements?
one user has one role and one role belongs to many users(one to many releation between user and role)
I need to ...
0
votes
1
answer
31
views
Rails Model.find is treating id as array. How do I get this to a act like a regular id?
I want to use a method from the Company model for a Product as follows:
def internal_email_recipients
product = Product.find(params[:id])
company = Company.find([product.producer.id])
...
0
votes
1
answer
310
views
How to correctly apply a has_many relationship with an order by in Ruby on Rails 6
I am creating a User model in Rails 6 to mirror a model that exists in a separate project.
There is a has_many relationship that is causing some problems.
class User < ApplicationRecord
...
0
votes
1
answer
642
views
Rails: attr_accessor association
Hello I am beginner for rails.
I have two models UserSubscriptions and SubscriptionPlan.
user_subscription.rb
class UserSubscription < ApplicationRecord
attr_accessor :new_plan_id
belongs_to ...
0
votes
0
answers
996
views
How to extend the properties in a join table generated by EF-Core-5 in a many-to-many entity relationship
I have just created an application with ASP,Net Core 5 and EF Core 5. It requires a many-to-many relationship between two entities - Bill and User. Thus a user can have many bills and a bill can apply ...
-3
votes
2
answers
345
views
R: How to determine which variables are associated with a missing data field
I have a dataset that I am trying to understand why one specific variable (Var1) has blank values.
I have two questions, and I use R (and am a novice coder):
Var1 is 60% complete (field in entered ...
0
votes
1
answer
167
views
Self referential association in Ruby on Rails
I have an app in which I have the "Patient" resource. I want to make a self association among patients, related to a viral infection. So, a patient can be an infectant, infected, or both. ...
0
votes
2
answers
333
views
How to find out all the association of a model?
Say I have following models
class User < ApplicationRecord
devise :database_authenticable,:registerable
:recoverable, :trackable, :validatable, :rememberable
belongs_to :loginable, ...
1
vote
1
answer
58
views
What is the "Rails Way" to re-associate posts or other objects attached to a user when said user is deleted?
I am implementing a system where when a user deletes his/her account posts they have made will be re-associated to an anonymous account so they can still be displayed for other users of my site.
My ...
0
votes
1
answer
227
views
Association using ES6 and default created Model (Model is not associated to Model)
What I am you doing?
I am trying to add association to my Folder model, using default created Model by CLI.
Important note is that I am trying to associate model to himself, so Folder.hasMany.Folder.
...
0
votes
1
answer
224
views
Rails user has many users through users
I'm fairly new to rails, and working on an app which essentially allows users to report grievances about other users (just a fun app i want to use with friends). Basically there are just two models, ...
0
votes
2
answers
66
views
Has_and_belong_to_many association
I have two models with no associations between them. So, I generated a migration and added an association.
class Post < ActiveRecord::Base
has_and_belongs_to_many :workspaces
end
class Workspace ...