473,788 Members | 3,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to build database to support user-specified entities and attributes?

I have a database that tracks players for children's sports clubs. I have
included representative DDL for this database at the end of this post.

A single instance of this database supports multiple clubs. I would like to
add support for letting each club define and store custom information about
arbitrary entities. Basically, allows the clubs to define custom entities
(i.e tables) and associated custom attributes (i.e. fields) that may be
related to existing tables (such as Player and FootballClub) or existing
entities. For instance, a club may define a PlayerAssessmen t entity that
records all player assessments.

To do this, I plan to support the following use case:
1. FootballClub admin creates a new entity and gives it a name and
description (Entity is only accessible to this FootballClub).
2. FootballClub admin indicates that the new entity has a M:1 relationship
with the Player table (this will add Player_ID as a FK attribute).
- {An entity may have no relationships.}
- {Relationships are also supported to other entities.}
3. FootballClub admin specifies the names and domain/types of any data
attributes (i.e. fields) of the entity.
- {An attribute's type may be constrained to a few allowable types like
Relationship, Integer, Float, Currency, Date, Time, DateTime, Name,
Description and Memo.}
4. System creates entity as specified.

A few constraints:
1. Any entity defined is "private" to the defining club. Other clubs aren't
aware of it although they may define custom entities of their own
with the same name and attributes. [Perhaps there is a way to share
definitions of identical entities?]
2. A club doesn't have to define any custom entities.

Ideas I've considered:
1. Generate DLL and create actual tables
- Restrict such customizations such that while admin is setting up entities,
no other user is allowed to use the system.
- Once entity definition is complete, generate an actual table using DLL.
Table and column names might be changed to enforce uniqueness/validity
constraints - this suggests a need for table/column name mapping.
- PROS: Easy to implement.
- CONS: Doesn't scale since only a limited number of tables can be created.
DDL on a live, shared system?. Scary!!
All users for all clubs will be locked out while entity is
created.

2. Generate DDL and create actual tables in secondary database(s)
- Same as above except that the user tables are created in secondary [,
shared] databases.
- PROS: Reassurance that DDL is never run on the "core" data
All users don't have to be locked out.
- CONS: Doesn't scale since only a limited number of tables can be created.
{ Unless I start creating additional databases too!. }
Still needs to DDL on a live, shared system.

Has anyone done anything similar?. Any ideas on how it might be done?. In
particular, is this possible without having to execute DDL on the live
database?

Kunle
=============== ==== BEGIN DDL =============== ====
CREATE TABLE FootballClub (
Club_ID int IDENTITY,
Name char(80) NOT NULL,
Area char(4) NOT NULL,
League char(4) NOT NULL,
City char(30) NOT NULL,
PRIMARY KEY (Club_ID)
)
go

exec sp_primarykey FootballClub,
Club_ID
go

CREATE TABLE Player (
Player_ID int IDENTITY,
First_Name char(30) NOT NULL,
Initials char(30) NULL,
Last_Name char(30) NOT NULL,
Date_Of_Birth datetime NOT NULL,
Position char(4) NULL,
Club_ID int NULL,
PRIMARY KEY (Player_ID),
FOREIGN KEY (Club_ID)
REFERENCES FootballClub
)
go

exec sp_primarykey Player,
Player_ID
go

CREATE TABLE UserAccount (
User_ID int IDENTITY,
Club_ID int NOT NULL,
FullName char(80) NOT NULL,
Logon char(20) NOT NULL,
PWD_Hash char(60) NOT NULL,
PRIMARY KEY (User_ID, Club_ID),
FOREIGN KEY (Club_ID)
REFERENCES FootballClub
)
go

exec sp_primarykey UserAccount,
User_ID,
Club_ID
go

exec sp_foreignkey Player, FootballClub,
Club_ID
go

exec sp_foreignkey UserAccount, FootballClub,
Club_ID
go
=============== ==== END DDL =============== ====

Jul 19 '05 #1
3 4379
First, I would limit capabilities to the following:
1. Custom player attributes.
2. Custom detail types with custom attributes.

Next, you can support multiple data types at the user interface level, but
don't try to do it with actual field types. Use 255 character text
(varchar(255) unless you're in Access).

Now, so support customization, let each club have their own label names for
each custom player attribute, and let them have their own detail type records
where each detail type defines the label names for the custom detail
attributes.

On Thu, 17 Mar 2005 15:42:28 +0000 (UTC), "Kunle Odutola"
<no******@reply ToTheGroup.nosp am.org> wrote:
I have a database that tracks players for children's sports clubs. I have
included representative DDL for this database at the end of this post.

A single instance of this database supports multiple clubs. I would like to
add support for letting each club define and store custom information about
arbitrary entities. Basically, allows the clubs to define custom entities
(i.e tables) and associated custom attributes (i.e. fields) that may be
related to existing tables (such as Player and FootballClub) or existing
entities. For instance, a club may define a PlayerAssessmen t entity that
records all player assessments.

To do this, I plan to support the following use case:
1. FootballClub admin creates a new entity and gives it a name and
description (Entity is only accessible to this FootballClub).
2. FootballClub admin indicates that the new entity has a M:1 relationship
with the Player table (this will add Player_ID as a FK attribute).
- {An entity may have no relationships.}
- {Relationships are also supported to other entities.}
3. FootballClub admin specifies the names and domain/types of any data
attributes (i.e. fields) of the entity.
- {An attribute's type may be constrained to a few allowable types like
Relationship , Integer, Float, Currency, Date, Time, DateTime, Name,
Description and Memo.}
4. System creates entity as specified.

A few constraints:
1. Any entity defined is "private" to the defining club. Other clubs aren't
aware of it although they may define custom entities of their own
with the same name and attributes. [Perhaps there is a way to share
definitions of identical entities?]
2. A club doesn't have to define any custom entities.

Ideas I've considered:
1. Generate DLL and create actual tables
- Restrict such customizations such that while admin is setting up entities,
no other user is allowed to use the system.
- Once entity definition is complete, generate an actual table using DLL.
Table and column names might be changed to enforce uniqueness/validity
constraints - this suggests a need for table/column name mapping.
- PROS: Easy to implement.
- CONS: Doesn't scale since only a limited number of tables can be created.
DDL on a live, shared system?. Scary!!
All users for all clubs will be locked out while entity is
created.

2. Generate DDL and create actual tables in secondary database(s)
- Same as above except that the user tables are created in secondary [,
shared] databases.
- PROS: Reassurance that DDL is never run on the "core" data
All users don't have to be locked out.
- CONS: Doesn't scale since only a limited number of tables can be created.
{ Unless I start creating additional databases too!. }
Still needs to DDL on a live, shared system.

Has anyone done anything similar?. Any ideas on how it might be done?. In
particular, is this possible without having to execute DDL on the live
database?

Kunle
============== ===== BEGIN DDL =============== ====
CREATE TABLE FootballClub (
Club_ID int IDENTITY,
Name char(80) NOT NULL,
Area char(4) NOT NULL,
League char(4) NOT NULL,
City char(30) NOT NULL,
PRIMARY KEY (Club_ID)
)
go

exec sp_primarykey FootballClub,
Club_ID
go

CREATE TABLE Player (
Player_ID int IDENTITY,
First_Name char(30) NOT NULL,
Initials char(30) NULL,
Last_Name char(30) NOT NULL,
Date_Of_Birth datetime NOT NULL,
Position char(4) NULL,
Club_ID int NULL,
PRIMARY KEY (Player_ID),
FOREIGN KEY (Club_ID)
REFERENCES FootballClub
)
go

exec sp_primarykey Player,
Player_ID
go

CREATE TABLE UserAccount (
User_ID int IDENTITY,
Club_ID int NOT NULL,
FullName char(80) NOT NULL,
Logon char(20) NOT NULL,
PWD_Hash char(60) NOT NULL,
PRIMARY KEY (User_ID, Club_ID),
FOREIGN KEY (Club_ID)
REFERENCES FootballClub
)
go

exec sp_primarykey UserAccount,
User_ID,
Club_ID
go

exec sp_foreignkey Player, FootballClub,
Club_ID
go

exec sp_foreignkey UserAccount, FootballClub,
Club_ID
go
============== ===== END DDL =============== ====


Jul 19 '05 #2
"Kunle Odutola" <no******@reply ToTheGroup.nosp am.org> wrote in message
news:d1******** **@hercules.bti nternet.com...
I have a database that tracks players for children's sports clubs. I have
included representative DDL for this database at the end of this post.


This is a breeze using Ingres. Create a user for each club. That user will
own the club's supplimentary tables. Create your core tables in the DBA
schema so they are visible to all users, and grant them to all relevant
users. Then allow the user who owns each club's tables to create the
supplimentary tables in their schema (this is allowed by default). That
user can then grant those tables to whichever other users he/she likes.
Because the supplimentary tables are in separate schemas for each club there
can be no naming collisions. (i.e. every club can have its own version of a
table called peanut_sales if it wants.)

Because DDL is transactional in Ingres, allowing users to create tables at
will is no less safe on a running system than any other kind of SQL.

Roy Hann (rhann at rationalcommerc e dot com)
Rational Commerce Ltd.
www.rationalcommerce.com
"Ingres development, tuning, and training experts"

Jul 19 '05 #3

"Steve Jorgensen" <no****@nospam. nospam> wrote in message
news:av******** *************** *********@4ax.c om...

Hi Steve,

Please expand on your message, I'm not sure I fully understand your proposed
solution.
First, I would limit capabilities to the following:
1. Custom player attributes.
2. Custom detail types with custom attributes.
What would be the "master" of the custom detail types. Please note that the
entity may not be directly related to a player. It might be about football
boots for instance.
Now, so support customization, let each club have their own label names for each custom player attribute, and let them have their own detail type records where each detail type defines the label names for the custom detail
attributes.


I'm not sure I'm follow this bit at all. What are label names and where are
they stored?. Ditto "detail type records". How would you express the essence
of your proposal in DDL/DML?

Kunle

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1544
by: Khue Pham | last post by:
Hi All, I'm building an embedded system and in need of bringing mySQL into my embedded controller. Here is what I need: + A minimal mySQL database configuration that supports: -> API for C program -> multi-process/concurrency (one process can read the database meanwhile other processes can write into it instantaneously) -> Support PHP
0
5610
by: Rob Young | last post by:
This is the latest in the "Total Non-Programmer" series. Any feedback on the usability of this tutorial would be greatly appreciated. Thanks, Rob How to Build A Web Database (Without Programming) This article will teach you step-by-step how to add interactive database-driven capabilities to your existing web site. When the steps
6
2162
by: H | last post by:
This is a question that has haunted me for quite some time. if you build a 4 tier database application where the 4th tier is the database server (MS SQL 2000), where do you build the connection string? The obvious answer is to hard code it into the middle layer and use a config file. The problem is the database application needs to be distributed to purchasing clients. Therefore, you do not know, at development, what the SQL
15
2742
by: grunar | last post by:
After some thought on what I need in a Python ORM (multiple primary keys, complex joins, case statements etc.), and after having built these libraries for other un-named languages, I decided to start at the bottom. What seems to plague many ORM systems is the syntactic confusion and string-manipulation required to build the SQL Statements. If you want to do a Left Outer Join, support nested functions, and a nested conditional clause, you'd...
0
1218
by: jonathan.beckett | last post by:
Just a quick message letting those who are interested know that a new version of the PluggedOut Blog script is available for download - more bugs have been squashed, and a new sample theme has been included. It's written in PHP, using a MySQL database. If you're just starting out with PHP, it's a pretty good example of how to build a database driven web application. Project Homepage (and Download)
6
1758
by: LurfysMa | last post by:
I am working on an electronic flashcard application. I have one version up and running using Visual Basic (6.0) and Access 2000. My long-range plans are to put it up on a website and sell subscriptions. But that is probably 2-3 releases away. In the meantime, I would like to put it up on the website for testing. I have been reading here and elsewhere that Access is not suitable for a web-based implementation. Is that because is was...
6
2148
by: iKiLL | last post by:
Hi all I am developing in C#, CF2 and SQL Mobile. Currently my app is using Merge Replication. This is all working well. I have now decided to try and use Result sets in my application but I am not sure on how to handle this. I have gone through examples on how to build a result set, but my
9
2675
by: =?Utf-8?B?TUNN?= | last post by:
I'm sure the answer to my question varies depending on the situation, but I am looking for a general "best practice". If I have an asp.net application and I load certain data from a database, should I use ViewState to store and reload the data, or should I load the data from the database on each postback? Assume for the sake of this question that I only care about performance, I don't care about ease of programming.
0
1956
by: Akira Kitada | last post by:
Hi Marc-Andre, Thanks for the suggestion. I opened a ticket for this issue: http://bugs.python.org/issue4204 Now I understand the state of the multiprocessing module, but it's too bad to see math, mmap and readline modules, that worked fine before, cannot be built anymore.
0
1818
by: M.-A. Lemburg | last post by:
On 2008-10-25 20:19, Akira Kitada wrote: Thanks. The errors you are getting appear to be related to either some missing header files or a missing symbol definition to enable these - looking at the ticket, you seem to have resolved all this already :-)
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.