data-modeling

Custom x-axis values in Power BI

五迷三道 提交于 2019-12-07 11:41:29
I want to plot a graph over a year+weeknumber on the x axis. Each data-point contains this specific value; for example week 7 of 2016 is expressed as 201607 etc. and called YearWeek I created a date table in which I calculate all possible YearWeek value in a certain date-range. Then I created a YearWeek table extracting all distinct YearWeeks. This I connected to the Fact-Table. What I want to chart is exactly according to this matrix: Note that I explicitly selected to show items with no data to obtain the full time line. It continues down to 201852 but you get the picture. When I attempt to

How to model process and status history in a data warehouse?

旧城冷巷雨未停 提交于 2019-12-07 07:32:51
问题 Let's say that we have D_PROCESS , D_WORKER and D_STATUS as dimensions, and the fact F_EVENT that links a process (what) with a worker (who's in charge) and the "current" status. The process status changes over time. Shoud we store in F_EVENT one line per process/status/worker, or one line per process/worker, and "somewhere else" one line per status change for a given process/worker? I'm new to Datawarehouse and it's hard to find best practices/tutorial related to data modelization. 回答1: Read

How to enforce uniques across multiple tables

北战南征 提交于 2019-12-07 05:52:12
问题 I have the following tables in MySQL server: Companies: - UID (unique) - NAME - other relevant data Offices: - UID (unique) - CompanyID - ExternalID - other data Employees: - UID (unique) - OfficeID - ExternalID - other data In each one of them the UID is unique identifier, created by the database. There are foreign keys to ensure the links between Employee -> Office -> Company on the UID. The ExternalID fields in Offices and Employees is the ID provided to my application by the Company (my

Get many webpages updation alerts. Systematic automated web scraping

陌路散爱 提交于 2019-12-06 15:31:12
I have used google sheet function IMPORTXML for scraping specific parts of webpages but It's not working properly with long xpath, not fluent, not smooth on tons of websites URL. I have also tried distill extension, excel scraping from web table but It is also not long term smooth solution. Please help to get notified on changes / updation of specific parts of tons of webpages. 来源: https://stackoverflow.com/questions/54444976/get-many-webpages-updation-alerts-systematic-automated-web-scraping

How to model this multiple inheritance relationship with a RDBMS?

亡梦爱人 提交于 2019-12-06 13:45:54
I'm looking at this data model I've come up with and not feeling comfortable. I've changed the entity names so it (hopefully) makes more sense. In any event, how would you model the following? I have 3 entities. GovernmentCustomer, PrivateCustomer, PublicCustomer. Private and Public Customer are both CorporateCustomers. Corporate and Government Customers are Accounts. All Accounts share the same key space (So if PrivateCustomer has a PK of 1 it shouldn't be possible for Public or GovernmentCustomer to have a PK of 1). CorporateCustomers have some 1:M relationships that GovernmentCustomer's don

Mysql: enum confusion

ぐ巨炮叔叔 提交于 2019-12-06 12:39:51
I have an employee table, employee has interests, so the table can be designed like this: create table emp( id int(10) not null auto_increment, name varchar(30), interest varchar(50), primary key(id) ); or this: create table emp( id int(10) not null auto_increment, name varchar(30), interest enum('football','basketball','music','table tennis','volleyball'), primary key(id) ); The number of interests can be about 50. How should i design the table? Should i use enum or others ? Edit: Thanks for your reponse. Assume that a person can be a Mr. or Madame or Ms. I make a drop down list in PHP.

React redux oop classes

醉酒当歌 提交于 2019-12-06 08:19:19
coming from angular i used to have a class for every entity in my DB, such class encapsulated all entity behaviour. for example users Class can look like export class User{ static notValid(u){ return !!((u.id && u.id > 0 && u.fullname && u.fullname.length > 2 && u.picture) === false); } static fromArray(arr){ let pack = []; for(let i=0;i<arr.length;i++){ pack.push(new User(arr[i])); } return pack; } constructor(u){ this.id = u.id || 0; this.fullname = u.fullname+'' || 'N/A'; this.picture = u.picture+'' || '/imgs/logo.png'; this.role = u.role || 'N/A'; this.username = u.username+'' || ''; this

Cassandra group by and filter results

不羁岁月 提交于 2019-12-06 06:19:10
I'm trying to mimic something like this: Given a table test : CREATE TABLE myspace.test ( item_id text, sub_id text, quantity bigint, status text, PRIMARY KEY (item_id, sub_id) In SQL, we could do: select * from (select item_id, sum(quantity) as quan from test where status <> 'somevalue') sub where sub.quan >= 10; i.e. group by item_id and then filter out the results with less than 10. Cassandra is not designed for this kind of stuff though I could mimic group by using user-defined aggregate functions : CREATE FUNCTION group_sum_state (state map<text, bigint>, item_id text, val bigint) CALLED

Designing a database with periodic sensor data

扶醉桌前 提交于 2019-12-06 04:13:20
问题 I'm designing a PostgreSQL database that takes in readings from many sensor sources. I've done a lot of research into the design and I'm looking for some fresh input to help get me out of a rut here. To be clear, I am not looking for help describing the sources of data or any related metadata. I am specifically trying to figure out how to best store data values (eventually of various types). The basic structure of the data coming in is as follows: For each data logging device, there are

Database Design: how to support multi-lingual site?

别等时光非礼了梦想. 提交于 2019-12-06 04:08:48
Suppose I have the table: TABLE: product ================================================================= | product_id | name | description | ================================================================= | 1 | Widget 1 | Really nice widget. Buy it now! | ----------------------------------------------------------------- If I want to provide multi-lingual support, what's the best approach to do that? Possible solutions: Add a "language" column to the above table; that'll indicate the language the particular record is. (I don't think this is an option for me since other tables will be using