query
a pythonic query language
Sign in or create a new account.


Parameters:
Address, Age, CauseOfDeath, City, County, Date, DayOfMillenium, DayOfWeek, Description, ImageURL, LawEnforcementAgency, Month, Name, NewsURL, OfficialDisposition, Prace, Sex, State, SymptomsOfMentalIllness, Year, Zip

The PyQL query format is: fields @ conditions.
  fields is a field or a comma delimited list of fields.
 conditions is a condition or an and delimited list of conditions.

Both fields and conditions are made up of terms.
A term is a valid Python expression in a name space made up of: database parameters; any imported python modules; PyQL Aggregators such as Average (A), Sum (S), and Replace (R); and other domain specific terms.

About the Fatal Encounter DatabaseSample Queries
The Data

This database was download as a spreadsheet from FatalEncounters.org. Brian Burghart maintains this spreadsheet and welcomes your support. You can e-mail Brian d.brian [at] fatalencounters.org.

The first step in importing Brian's spreadsheet into a PyQL database involved taking non-alpha numberic characters out of headers and using them in CamelCase. For example, the spreadsheet header of 'law enforcement agency' becomes the database parameter 'LawEnforcementAgency'.

Agile Access to Database Parameters

The CamelCaseFormatting of database parameters is logical, readable, and verbose. With domain specific query languages you get to make the rules for parameter reference. And here we like: Access parameters by their capitalized letters and fill in lower case letters as needed to remove ambiguity. Like this for getting the the Date,Name,CauseOfDeath,OfficialDisposition, and the Prace (perceived race) for fatal encounters with law enforcement in Multnomah County:
Date,Name,COD,OD,Prace@Co='Multnomah'

To see the number of fatal encounters with law enforcement for each city in the database, use the PyQL: S(1),R(City)@City

This query form is handy for breakdown by any parameter. To see fatal encounters by state, use the PyQL: S(1),R(St)@St

And likewise for CauseOfDeath, use the PyQL: S(1),R(COD)@COD

And for Prace (perceived race), use the PyQL: S(1),R(P)@P

To see details of all fatal encounters in Portland, Oregon, use the PyQL: Name,Date,COD,OD,SOMI@City='Portland' and State='OR' s.