data-modeling

Got an Oracle Table Named as Reserved Word, Which problems may arise?

青春壹個敷衍的年華 提交于 2019-12-13 15:26:15
问题 We just got a system outsourced and at first glance i can see some tables and fields with names as CASE or FROM. It is an Oracle 10g DB and we are going to be consuming those data from Java, Hibernate, C#, C++. Is there something special we should be aware of? For what i've seen in other posts this is not recommended because it will affect readability of our code, but is there any other, major or more serious problems this could cause? Thanks! 回答1: To escape reserved words in Oracle, you need

tool to extract data structures from unclean data

坚强是说给别人听的谎言 提交于 2019-12-13 05:43:44
问题 I have unstructured geneally unclean data in a database field. There are common structures which are consistent in the data namely: field: name:value fieldset: nombre <FieldSet> field, . . . field(n) table nombre <table> head(1)... head(n) val(1)... val(n) . . . I was wondering if there was a tool (preferably in Java) that could extract learn/understand these data structures, parse the file and convert to a Map or object which I could run validation checks on? I am aware of Antlr but

Moving table columns to new table and referencing as foreign key in PostgreSQL

两盒软妹~` 提交于 2019-12-13 05:37:37
问题 Suppose we have a DB table with fields "id", "category", "subcategory", "brand", "name", "description", etc. What's a good way of creating separate tables for (eg.) "category", "subcategory" and "brand" and the corresponding columns and rows in the original table becoming foreign key references? To outline the operations envolved: - get all unique values in each column of the original table which should become foreign keys; - create tables for those - create foreign key reference columns in

how do I design intermittent via points for travel itinerary

此生再无相见时 提交于 2019-12-13 02:57:52
问题 I am trying to design the backend and have the following use case. I have flight information from point A to B and need to define a schema which supports different use cases. I'm trying to find a good way to handle the case, when there are stopover via points. For e.g. flight route for A -> B actually looks like this: A -> C C -> D D -> B so A -> B is one entity, but in turn, it is comprised of several legs. My current design: AirLeg table: - id - departure and arrival information - viaPoints

NDB using Users API to form an entity group

你离开我真会死。 提交于 2019-12-12 22:08:40
问题 I'm trying to wrap my head around what seems to be a very simple use case, but I seem to be failing miserably. The goal of the exercise is to look up a set of records for the user that logs in using the Google Accounts username within the high replication datastore and be extremely consistent. My data looks like this: class Account(ndb.Model): owner = ndb.UserProperty() name = ndb.StringProperty() class Content(ndb.Model): content = ndb.StringProperty() When I first create the account, I just

Extentions of the Django docs' pizza example (screen for pizzas by topping)

↘锁芯ラ 提交于 2019-12-12 18:33:25
问题 Over at https://docs.djangoproject.com/en/dev/topics/db/models/#many-to-many-relationships, the Django team describes many-to-many relationships in the context of pizzas and toppings. I have taken their example to try to find a solution to a conceptual problem I am having with modelling my own data. For the purpose of explaining exactly what I am tying to accomplish as a result of this Stack Overflow post, consider the following (hypothetical) grammar: TOPPING = {'a'..'z' | 'A'..'Z'}; FLOAT =

EF4 Self referencing with association 0..1 -> 1

ⅰ亾dé卋堺 提交于 2019-12-12 16:59:31
问题 There's a lot of reading on self referencing problems, but I can't seem to find an answer to my question. Say I have a Human (A), and I want A to have a partner, another Human(B). Naturally, it means that B has a partner in human A. How would you solve this? Ideally, I should only have to do: humanA.Partner = humanB; and humanB would automatically get humanA as a partner. I would have thought I could create a Human enity, and add an Association, something like: End1 Entity: Human ,

Rails modeling: converting HABTM to has_many :through

冷暖自知 提交于 2019-12-12 10:57:23
问题 I'm doing maintenance work on an existing Rails site and am having some problems stemming from many-to-many associations. It looks like the site was initially built using has_and_belongs_to_many for a few relationships that have since gotten more complicated in the business logic, so I need to use has_many :through instead to support additional fields in the relationship table. However, the join table that was initially used for HABTM doesn't have a primary key, and I've got to add one to

ndb many to many, retrieve list of one of the relation

为君一笑 提交于 2019-12-12 01:56:01
问题 I've this table class ClubMembership(GCModel): member = ndb.KeyProperty(kind='User', required=True) club = ndb.KeyProperty(kind='Club', required=True) is_active = ndb.BooleanProperty(default=True) membership_type = ndb.StringProperty(choices=set(["MEMBER", "TRAINER", "OWNER"]), default="MEMBER", required=True) Then in the Table Club i've this class Club(GCModel): @property def members(self): return ClubMembership.query(ndb.AND(ClubMembership.club == self.key, ClubMembership.membership_type ==

how do I design return travel itinerary vs one way itinerary

旧城冷巷雨未停 提交于 2019-12-12 01:52:46
问题 I'm not quite sure how to approach this problem: Price for one-way trips is different than price for round trip itineraries. In the backend, I have a table for storing the itinerary (which yields an id). I have another pricing table, which defines what is the price of this id from startDate to endDate. My itinerary table can only represent information for one way travel. How do I model round trip itineraries ? One way to deal with this was: have another column in the table: returnId if