relational-database

what is the correct way to design a 'table to row' relationship?

丶灬走出姿态 提交于 2020-02-06 15:42:33
问题 I am trying to model the following in a postgres db. I have N number of 'datasets'. These datasets are things like survey results, national statistics, aggregated data etc. They each have a name a source insitution a method etc. This is the meta data of a dataset and I have tables created for this and tables for codifying the research methods etc. The 'root' meta-data table is called 'Datasets'. Each row represents one dataset. I then need to store and access the actual data associated with

hibernate sets dirty flag (and issues update) even though client did not change value

不羁岁月 提交于 2020-02-04 08:43:44
问题 hibernate dirty flag works great for what they call "persistent" objects https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/objectstate.html but i have a web app, where the hib mang entity Order is also used as the Spring MVC command object. so when my controller marshals the request into an order, it is what hibernate calls a "detached" object. my problem senario can be illustrated with 2 web clients and 4 web requests against a single order. 1 - client 1 opens the order in detail

Core Data: Abstract entities and inheritance relationships

空扰寡人 提交于 2020-02-02 10:27:40
问题 My exact model is complicated to explain, so say that I'm modeling fruits and their seeds in Xcode's Core Data modeler. Here's some "pseudo Core Data code": abstractEntity Fruit attribute sweetness relationship Seed abstractEntity Seed attribute shape concreteEntity Apple inherits Fruit concreteEntity Orange inherits Fruit concreteEntity AppleSeed inherits Seed concreteEntity OrangeSeed inherits Seed The reason I modeled in this way is that I want to be able to fetch a mix of fruits and sort

What is the purpose of a database table that contains only primary and foreign keys?

﹥>﹥吖頭↗ 提交于 2020-02-02 09:43:37
问题 I'm trying to understand a simple music database design. There are some tables that contain only foreign keys and a primary key. I'm not sure how and when to use these tables or what to insert into them. The design looks like this: Track: id primary key title duration live-performance (true or false) year Artist: id primary key name ArtistTrack: id primary key artistID trackID Album: id primary key title AlbumTrack: id primary key albumID trackID track-number Genre: id primary key name

Hibernate does not create Table in the database

前提是你 提交于 2020-01-30 11:23:09
问题 I am using PostgreSQL and I am trying to run a simple Hibernate application, in particular the application decribed in the page. My hibernate.cfg.xml file is: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> <property name=

How do I get around this relational database design smell?

自古美人都是妖i 提交于 2020-01-30 09:20:09
问题 I have a really simple mediaTypes table which contains the following columns: id string name string Each mediaType record can have many "placements", which could easily be designed as follows: Placements id string mediaTypeId string (links to mediaTypes.id) name string detail_col_1 detail_col_2 ...etc However depending on the media type, a placement can contain different details, so if I designed the schema this way I may end up with a lot of nullable columns. To get around this, I could have

How do I get around this relational database design smell?

心已入冬 提交于 2020-01-30 09:20:06
问题 I have a really simple mediaTypes table which contains the following columns: id string name string Each mediaType record can have many "placements", which could easily be designed as follows: Placements id string mediaTypeId string (links to mediaTypes.id) name string detail_col_1 detail_col_2 ...etc However depending on the media type, a placement can contain different details, so if I designed the schema this way I may end up with a lot of nullable columns. To get around this, I could have

Python backed SQL Database returning a psycopg2.ProgrammingError: relation does not exist error when attempting to delete the data within a table?

我怕爱的太早我们不能终老 提交于 2020-01-26 04:31:14
问题 Intro: I have been working on building a Python backed PostgreSQL database of a Swiss style tournament using Vagrant running a Ubuntu VM for my Relational Database course in Udacity. Question: Why does it say the table does not exist when I attempt to delete the information within the existing table? I did a generic search to research psycopg2.ProgrammingError , but the information is mostly specific to other circumstances, and I was unable to make logical connections that would allow me fix

Combine two dataframes based on ranges which may partially overlap using Pandas and track multiple values

天大地大妈咪最大 提交于 2020-01-25 08:52:06
问题 I have two big dataframes (100K rows), One has 'values', one has 'types'. I want to assign a 'type' from df2 to a column in df1 based on depth. The depths are given as depth 'From' and depth 'To' columns. The 'types' are also defined by depth 'From' and 'To'. BUT they are NOT the same intervals. df1 depths may span multiple df2 types. I want to assign the df2 'types' to df1 and if there are multiple types, try and capture that information too. Example below. import pandas as pd import numpy

Relational databases and CodeIgniter

北城以北 提交于 2020-01-25 00:13:08
问题 I'm using CodeIgniter to build a website, and I want to show a list of construction projects from a database table, which we will simply call project_table . For each project I also have an address, stored in another table, address_table , each address has a project_id , which links it to a project. I have made a function, get_projects, in my projects model, which is used to get the project information and pass it to the project view, like such: public function index() { $data['projects'] =