Mack Wade
Chapter 8: manipulating Spatial and Tabular Data
Terms:
Comma separated Value (CSV): a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format.
Data Lock: There are two states of a lock i.e locked and unlocked. A lock is a class in the threading module whose object is generated in the unlocked state and has two primary methods i.e acquire() and release() .
Mode: refers to the most frequently occurring number found in a set of numbers.
Parsing: the processing of a piece of python program and converting these codes into machine language.
Postfix clause: An SQL postfix clause is positioned in the second position and will be appended to the SELECT statement, following the where clause. The SQL postfix clause is most commonly used for clauses such as ORDER BY.
Prefix clause: The PREFIX clause declares any abbreviations for URIs that you want to reference in a query. You can declare prefixes to simplify query text if your data includes long URI names. If you do not declare prefixes, you must include the full URI names in the query.
SQL clause: Clauses are in-built functions available to us in SQL. With the help of clauses, we can deal with data easily stored in the table. Clauses help us filter and analyze data quickly. When we have large amounts of data stored in the database, we use Clauses to query and get data required by the user.
SQL expression: An expression is a combination of one or more values, operators, and SQL functions that evaluate to a value. An expression generally assumes the datatype of its components.
SQL keyword: the reserved words that are used to perform various operations in the database. There are many keywords in SQL and as SQL is case insensitive, it does not matter if we use for example SELECT or select.
Structured query language (SQL): a programming language designed to get information out of and put it into a relational database. Queries are constructed from a command language that lets you select, insert, update and locate data.
Triple Quotes: allowing strings to span multiple lines, including verbatim NEWLINEs, TABs, and any other special characters. The syntax for triple quotes consists of three consecutive single or double quotes.
Review Questions
- What are the three different cursors, and what purpose does each one serve?
cursor.fetchall() fetches all the rows of a query result. It returns all the rows as a list of tuples. An empty list is returned if there is no record to fetch.
cursor.fetchmany(size) returns the number of rows specified by size argument. When called repeatedly, this method fetches the next set of rows of a query result and returns a list of tuples. If no more rows are available, it returns an empty list.
cursor.fetchone() method returns a single record or None if no more rows are available
- Explain how data locks occur and how they can be removed.
- A lock is a class in the threading module whose object generated in the unlocked state and has two primary methods i.e acquire() and release() .
- When writing SQL expressions, why are quotation marks sometimes an issue?
- Single quotes are used to indicate the beginning and end of a string in SQL. Double quotes generally aren’t used in SQL, but that can vary from database to database. Stick to using single quotes.