Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(except': 0.05; 'say,': 0.05; 'column': 0.07; 'null,': 0.07; 'table.': 0.07; 'inserted': 0.09; 'integer,': 0.09; 'internally': 0.09; 'okay': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'report,': 0.09; 'rows': 0.09; 'specifying': 0.09; 'timestamp': 0.09; 'index': 0.13; 'modification': 0.15; 'represents': 0.15; "skip:' 30": 0.15; '"private"': 0.16; '(name,': 0.16; '(warning,': 0.16; 'blocks': 0.16; 'encryption': 0.16; 'fully,': 0.16; 'gpg': 0.16; 'intersection': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'row': 0.16; 'later': 0.16; 'duplicate': 0.17; 'expanded': 0.17; 'integer': 0.17; 'subject:request': 0.17; 'thu,': 0.17; 'appears': 0.18; 'code,': 0.18; 'feb': 0.19; 'changes': 0.20; '+0000': 0.20; 'holds': 0.20; 'combination': 0.22; 'keys': 0.22; 'number)': 0.22; 'permitted': 0.22; "i'd": 0.22; 'player': 0.23; 'references': 0.23; 'tables': 0.23; 'this:': 0.23; 'command': 0.24; 'appear': 0.26; '(which': 0.26; 'creating': 0.26; 'select': 0.26; 'skip:" 20': 0.26; 'candidate': 0.26; 'role': 0.26; 'done.': 0.27; 'implemented': 0.27; 'possibility': 0.27; 'possible,': 0.27; 'correct': 0.28; 'header:X-Complaints-To:1': 0.28; 'record': 0.28; 'key,': 0.29; 'leaves': 0.29; 'once.': 0.29; 'scheme.': 0.29; 'table,': 0.29; 'teams,': 0.29; 'handled': 0.29; 'probably': 0.29; "i'm": 0.29; 'normally': 0.30; 'primary': 0.30; 'stuff': 0.30; 'code': 0.31; '(and': 0.32; 'etc.)': 0.32; 'german': 0.32; 'structure': 0.32; 'could': 0.32; 'message.': 0.33; 'correctly.': 0.33; 'null': 0.33; 'text,': 0.33; 'url:home': 0.33; 'handle': 0.33; 'to:addr:python- list': 0.33; 'likely': 0.33; 'another': 0.33; 'changed': 0.34; 'text': 0.34; 'list': 0.35; 'needed': 0.35; 'table': 0.35; 'similar': 0.35; 'something': 0.35; 'there': 0.35; 'next': 0.35; 'received:org': 0.36; 'but': 0.36; 'smaller': 0.36; 'totally': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'display': 0.36; 'editor': 0.37; 'itself': 0.37; 'does': 0.37; 'uses': 0.37; 'previous': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'login': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'called': 0.39; 'identify': 0.61; 'between': 0.63; 'different': 0.63; 'information': 0.63; 'more': 0.63; 'note:': 0.64; 'here': 0.65; 'taking': 0.65; 'players': 0.65; 'overall': 0.66; 'contact': 0.68; 'phone': 0.68; 'lose': 0.71; 'foreign': 0.72; 'special': 0.73; 'score': 0.75; 'address,': 0.79; '2013': 0.84; 'game,': 0.84; 'remarks': 0.84; 'season': 0.84; 'viewers': 0.84; 'dennis': 0.91; 'league': 0.91; 'scores': 0.91; 'skip:/ 30': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Improve reduce functions of SQLite3 request Date: Thu, 07 Feb 2013 13:03:23 -0500 Organization: > Bestiaria Support Staff < References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-253-109-163.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 220 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360260220 news.xs4all.nl 6985 [2001:888:2000:d::a6]:39504 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38358 On Thu, 7 Feb 2013 11:33:00 +0000 (UTC), Steffen Mutter declaimed the following in gmane.comp.python.general: > Okay, let's have a look at the scheme. > Every row represents all the data needed to display a single game fully, > here it is: > tables for each season are named like this: Runde[begin-year][end-year] > so: > CREATE TABLE "Runde20122013" ( Is that table name specifying a playing season? What happens next season -- you create a new table and duplicate all the code or edit the code to use the new name (and lose all access to the previous seasons)? The playing season should be a field in the table so that you don't have to change the application each year. > "Spiel" INTEGER PRIMARY KEY, > "Staffel" TEXT NOT NULL, > "Datum" TEXT, > "Zeit" TEXT, > "Halle" INTEGER, > "Heim" TEXT, > "Gast" TEXT, > "HeimNr" INTEGER, > "GastNr" INTEGER, These four items appear, to me, to be a weakness. They should, (again) to me, be a pair of foreign key references (to the same single table). (warning, the following is pseudo code, not real SQL -- also, I'm going to be mixing your German names with English names where I'm creating something totally new) "HeimID" integer foreign key references Teams (ID), "GastID" integer foreign key references Teams (ID), where create table Teams ( ID integer primary key autoincrement, Name text, Number integer, unique index (Name, Number) ) You have only one place where a team name&number appears, and a combination appears only once. This avoids the possibility of someone changing "Heim", say, but not changing "HeimNr" at the same time. It also ensures that you don't have different spellings appear for the same team. "Heim" and "Gast" are just the role the teams are taking for that game; but overall there is no difference between teams, so just one Teams table. A Teams table could also be expanded to hold information about where the team is based (a contact address, say); and gives you something your player list could link to create table TeamPlayers ( ID integer primary key autoincrement, TeamID integer foreign key references Teams(ID), PlayerID integer foreign key references Players(ID), StartDate date not null #date the player started on this team EndDate date default null #date player leaves team ) create table Players ( ID integer primary key autoincrement, Name text, Address text, Phone text, otherstuff ) > "Termin" TEXT, <--- OOPS! Thank you for pointing on the design!!! > "HT" INTEGER, > "GT" INTEGER, > "HP" INTEGER, > "GP" INTEGER, > "melderID" INTEGER, > "bemerkung" TEXT, > "verband" TEXT, > "regional" TEXT, > "landes" TEXT, > "kreis" TEXT, > "schiriID" INTEGER, > "editorID" INTEGER, > "lastchange" TEXT ); > > The 'Spiel' column holds the number of the game, it's the primary key > which could be used to join data later for a game report, where the > players and the scores they did are inserted by their trainers. > Not implemented yet... create table PlayerScores ( ID integer primary key autoincrement, SpielID integer foreign key references Rundes(Spiel), PlayerID integer foreign key references Players(ID), Score integer not null ) > > So 'Staffel' = league. There are many similar leagues with the exactly > the same name all over the table, so I need some other rows to get > things sorted correctly. Just like I did with Teams above -- this should be StaffelID integer foreign key references Leagues(ID) with create table Leagues ( ID integer primary key autoincrement, Name text, whatever-else-is-needed #to fully identify the specific league ) (oh, by the way, I think what you are calling "rows" are normally called "columns"; a "row" is one record with everything in the schema) > Together with 'verband','regional','landes','kreis' you can pick the > correct position of this special league in the command structure of Okay, those are probably the "whatever-else-is-needed". > the german handball federation called 'dhb'. > > /dhb/shv/baden/karlsruhe/mJC-KL1 is my team I train. > > Halle is the ID-Number of > the place where the game is played. Since you say "ID-Number", this is probably a candidate for another foreign key to a table of "Halles" (which could hold a formal name, the address, etc.) > > lastchange represents the last timestamp when the last modification > was done. > > melderID represents the one (man or machine), who inserted > the result of the game. > > editorID the last real personID who changed > someting. > bemerkung = remarks is for the editor what was edited. These all come across as fields that should be handled by the application, and never entered/changed by users (except the remarks entry)... > > See above. Use more public keys to encrypt the data and more people can > see it. Okay -- looking at GPG sites does indicate it can do multi-recipient encryption -- but that's likely to result in very large blocks of cypher-text (depending on what it uses internally -- one copy of the message per recipient, or a smaller one-time key that is encrypted for each and then used to decrypt the single message. I'd still prefer to use, as much as possible, the database system itself to handle this task... Stuff the "private" information into another table, and use an intersection table to link it to those permitted to see it, and to the particular game (I could over normalize this, but won't) create table PrivateViewers ( ID integer primary key autoincrement, MessageID integer foreign key references Messages(ID), ViewerID integer foreign key references Viewers(ID), unique index (SpielID, ViewerID) ) create table Viewers ( ID integer primary key autoincrement, Name text, Role text #planner or referee, or player, or unprivileged ) Note: "Viewers" may just be your authorized user login system -- somehow you need to get an ID for each user authorized to make changes to the data create table Messages ( ID integer primary key autoincrement, SpielID integer foreign key references Rundes(Spiel), Message text ) You only allow access to Messages IF the current user is in PrivateViewers. select m.Message from Messages as m inner join PrivateViewers as pv on m.ID = pv.MessageID inner join Viewers as v on pv.ViewerID = v.ID where m.SpielID = and v.Name = and v.Role in ("planner", "referee"); #others not allowed access -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/