many-to-many

Sqlalchemy : association table for many-to-many relationship between template_id and department. How can I delete a relationship?

為{幸葍}努か 提交于 2019-12-12 04:12:20
问题 Department = models.department.Department association_table = Table('template_department', models.base.Base.instance().get_base().metadata, Column('template_id', Integer, ForeignKey('templates.id')), Column('department_id', Integer, ForeignKey('departments.id'))) class Template(models.base.Base.instance().get_base()): __tablename__ = 'templates' id = Column(Integer, primary_key=True) tid = Column(String(7), unique=True) .... departments = relationship('Department', secondary=association_table

Many-to-many relationship with different data types

半腔热情 提交于 2019-12-12 03:46:21
问题 Our app has been customized to handle many different types of customers, with certain settings that will only apply to a few or one customer. Rather than continuously adding nullable columns to the customers table, I decided to add a [Settings] table to allow each setting to be a row. [dbo].[Settings] [SettingID] [int] [SettingCode] [nchar](4) [SettingDescription] [nvarchar](255) Which is then linked to the [Customers] table through a many-to-many table [dbo].[Customer_Settings] [Customer

RestKit many to many relationship saves new rows in both join table and null values in main table

醉酒当歌 提交于 2019-12-12 03:43:02
问题 I use RestKit to cache data from a remote server locally. In it I have a many to many relationship between Category <<-->> News. The mapping seems to work properly, despite that it also saves null values in my Category table (it saves the correct categories too). Like the image below: It seems to save 30 null rows, I also have 30 (not null) rows in my join table so there might be a correlation here. The JSON that I get looks like this: "categories":[{"category_id":1},{"category_id":4}] I have

JPA ManyToMany: set/update by list of ids instead of list of actual objects

一世执手 提交于 2019-12-12 03:10:35
问题 I have two domain classes with a many-2-many relationship between them, e.g. User and Group. There's a user2group table in the database to map this relationship. If I want to set User's Groups based on a list of Group IDs (which might come e.g. from a HTML form) do I really have to fetch the Groups first to update the User through setUsers(Set<Users>) ? I already have the Group IDs and they are actually the only information needed to update the mapping table... I'm using Spring Data JPA and

Add item and update relationship in transitional table in many-to-many database Sql Server

社会主义新天地 提交于 2019-12-12 02:43:53
问题 --here was wrong model without association manyTOmany between A-B. corrected is in EDIT2-- A exists in database, B exists in database. I need only enter new C element with some Properties1 and Properties2 (and update collections of C in existed A and B elements) I tried many options, like for example this, but still somethings wrong (with ObjectOCntext and existed Key etc) void SaveNewC(C newC) { using (var context = new MyEntities(connectionString)) { var dbA = context.A.Where(a => a.Id ==

How to implement many to many association using through in Sails?

戏子无情 提交于 2019-12-12 02:43:29
问题 I'm using Sails v0.11.2 and MongoDB 3.2 on Mac OS X El Capitan and I'm trying to implement Many-To-Many association using Through option which isn't supported yet. However, googling I found this Waterline Github Issue and elennaro , a github user, gave me a couple of links with some examples: First one Second one I have tried to adapt them to my own Sails app but I can't make it works. I got no errors on the console but the record or document on the intermediary table is not created only the

Django setting many_to_many object while doing a bulk_create

你。 提交于 2019-12-12 02:13:33
问题 I am using Django 1.9 and am trying the bulk_create to create many new model objects and associate them with a common related many_to_many object. My models are as follows #Computational Job object class OT_job(models.Model): is_complete = models.BooleanField() is_submitted = models.BooleanField() user_email = models.EmailField() #Many sequences class Seq(models.Model): sequence=models.CharField(max_length=100) ot_job = models.ManyToManyField(OT_job) I have thousands of Seq objects that are

Kohana many-to-many relationship “has many - through”

落花浮王杯 提交于 2019-12-12 01:43:41
问题 I'm using kohana v3.3, and i would like to know if there is a possibility to get/save another data in the pivot table or not ? let's take the Auth example : So we have 3 tables (roles, users, roles_users) and i added another column "date" on the pivot table Tables : CREATE TABLE IF NOT EXISTS roles ( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT, name varchar(32) NOT NULL, description varchar(255) NOT NULL, PRIMARY KEY ( id ), UNIQUE KEY uniq_name ( name ) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Problem with NHibernate not detecting other associations when all-delete-orphan is set on a M:N relationship

☆樱花仙子☆ 提交于 2019-12-12 01:39:35
问题 Here's the scenario: I have 3 objects called Person, VideoGame, and Store. One Person can have many VideoGames One VideoGame can belong to many Persons Same M:N relationship is between Store and VideoGames In the DB, the only thing besides these entities are two simple join tables PersonsVideoGames and StoresVideoGames. Assume everything has an Id property and they are unique. Business Rules: I do not want a video game to be in the VideoGames table if it is not associated with anything (an

Create a record into many2many table using Web service API in odoo 8

删除回忆录丶 提交于 2019-12-12 01:36:06
问题 I need to create a record in mail_vote table(many2many) with fields message_id and user_id Using Web service API. I found a document here: https://www.odoo.com/documentation/8.0/reference/orm.html#openerp.models.Model.write . But i don't know how to use that in my code. Any solution please. 回答1: Below i am posting the code snippet for associating (6,0,[ids])] the Many2many record in product.attribute.line . In Php here i have used ripcord for this task. $existing_prodid = 59; $existing