Questions tagged [database-integrity]

48 questions
1
vote
1 answer

How to update further tables on adding a relationship in propel

I'm trying to work out where is the best place to update other related tables when changing a foreign-key dependency. To be precise, I have a table called 'flat' and another called 'room' which contains flat_id: {type: INTEGER, foreignTable:flat,…
Colin Fine
  • 3,334
  • 1
  • 20
  • 32
0
votes
1 answer

integrity constraint in Oracle

Suppose that a table named SuplProd has the columns supplier and product and two entries: (Sony Ericcson, Xperia) and (Apple, iPhone). I would like to create a table named Orders with columns supplier, product and quantity. However, I'd like the…
niels
  • 760
  • 8
  • 25
0
votes
0 answers

Running pymongo to save data in local mongoDB database

I was trying to save data from jupyter notebook in Visual Studio Code into my local mongoDB database. Previously, I had multiple databases in my local mongoDB server. However, after running the pymongo code, all the existing databases got deleted…
0
votes
1 answer

Integrity constraint issue in an inheritance relational model with MySQL 5.5

I have the following database relational schema that purports to model an EMP supertype together with two FULL_TIME_EMP and PART_TIME_EMP subtypes: The problem I have is one of integrity i.e. I would like to make sure that a full-time employee can…
balteo
  • 23,602
  • 63
  • 219
  • 412
0
votes
1 answer

Integrity Error on DRF on fixture teardown

I have these 2 models in Django: class Invoice(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) owner = models.ForeignKey(to="User", on_delete=models.CASCADE) client =…
0
votes
1 answer

Integrity constraints to make sur two columns contain same values for two related tables

I have two tables in my oracle database. +--------+ +---------+ + data + --1..0-------0..n --+ PAQ + +--------+ +---------+ PAQ has many data. Here is an example of how they're made: create table…
OSEMA TOUATI
  • 327
  • 2
  • 13
0
votes
2 answers

How to prevent IntegrityError in case of using UUID in django

I want to use UUID as PK in my django model as follows (database is Postgresql): class Post(models.Model): pk = models.UUID(primary_key=True, unique=True, default=uuid.uuid4, editable=False) ... Every time uuid.uuid4 generates a new UUID.…
msln
  • 1,318
  • 2
  • 19
  • 38
0
votes
1 answer

Better to store miscellaneous metadata in database or calculate on each access

I have a number of attributes I need for various page loads and other backend tasks, and I'm debating on whether storing these things in a database or calculating them on the fly. For instance, if there are files that users can upload, and you want…
0
votes
0 answers

The transient database snapshot for database XXXXX (database ID 8) has been marked suspect due to an IO operation failure

I am having OLA hallengren job for the DBCC checks When the job runs as per the schedule iam getting below error The transient database snapshot for database XXXXX (database ID 8) has been marked suspect due to an IO operation failure. In the error…
0
votes
1 answer

Hopefully simple SQL question for enforcing immutability of a column based on the value of another column

I have a table with a Value column and a Status column. What is the simplest and most effective way to enforce the following? The idea is that money values are entered into the database and then someone says "Final" and after that I need to…
Aaron Anodide
  • 16,906
  • 15
  • 62
  • 121
0
votes
1 answer

How to ensure the data integrity using SQL Server?

I have a table with billions of rows in SQL Server. I want to ensure that the data is read-only (immutable) and always will not changed after being inserted into the database. My current thought is to use SHA3 hash algorithm to make a hash chain.…
ichbinblau
  • 4,507
  • 5
  • 23
  • 36
0
votes
2 answers

Spring JPA + Hibernate : OneToMany bidirectional persisting

How to persist child entity in oneToMany relationship ? @Entity public class Payment implements Serializable { @ManyToOne(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY) @JoinColumn(name = "registration", nullable = false) private…
Mezoo
  • 677
  • 2
  • 10
  • 18
0
votes
1 answer

What is the good approach to check an existance of unique values in database table by SqlAlchemy in python2.7

I use session.merge in SqlAlchemy to insert data to the table with UniqueConstraint, which is common for several columns, for example, my ORM class has the following: UniqueConstraint("attr_1", "attr_2", "attr_3", name="attributes_uix") Should I…
0
votes
1 answer

"SQLSTATE[23000]: Integrity constraint violation" in Doctrine

i do get an Integrity constraint violation for Doctrine though i really can't see why. Schema.yml User: columns: id: type: integer primary: true autoincrement: true username: type: varchar(64) notnull: true …
Andresch Serj
  • 35,217
  • 15
  • 59
  • 101
0
votes
0 answers

SQL Server. Table resides in a filegroup which is not online

I have such a table structure: CREATE TABLE Table1 ( Id1 INT IDENTITY(1,1) NOT NULL PRIMARY KEY, Value VARCHAR(50) ) ON [PRIMARY] GO CREATE TABLE Table2 ( Id2 INT IDENTITY(1,1) NOT NULL PRIMARY KEY, Value VARCHAR(50) ) ON…
GriGrim
  • 2,891
  • 1
  • 19
  • 33