Database V08 For Mac


SQLPro Studio is the Premier application for editing and viewing mysql, postgres, oracle and microsoft sql server databases on mac os x. DBASE Mac was a database management system for the Apple Macintosh, released by Ashton-Tate in 1987. Although the GUI was lauded in the press, the application was so slow that it became something of a joke in the industry. Sales were dismal.

Conventions - row containers and row iterators This package defines the following convention for objects acting as containers of tabular data and supporting row-oriented iteration over the data. from StringIO import StringIO import csv csvdata = 'foo,bar. ' rowiterator = csv. Reader ( StringIO ( csvdata )) for row in rowiterator. 'foo', 'bar' 'a', '1' 'b', '2' for row in rowiterator.

# can only iterate once However, it is straightforward to define functions that support the above convention for row containers and provide access to data from CSV or other types of file or data source, see e.g. The function in this package. The main reason for requiring that row containers support independent row iterators (point 3) is that data from a table may need to be iterated over several times.

E.g., when using petl in interactive mode to build up a sequence of data transformation steps, the user might want to examine outputs from several intermediate steps, before the transformation is complete. Note that this convention does not place any restrictions on the lengths of header and data rows.

A table may return a header row and/or data rows of varying lengths. look ( table5 ) +-+-+-+-+ 'foo' 'bar' 'baz' 'quux' 'A' 1 3.4 3.4 +-+-+-+-+ 'B' 2 7.4 14.8 +-+-+-+-+ 'C' 6 2.2 00000001 +-+-+-+-+ 'D' 9 8.1 9999999 +-+-+-+-+.although note that will by default only request the first 10 rows, and so at most only 10 rows will be processed. Calling to inspect the first few rows of a table is often an efficient way to examine the output of a transformation pipeline, without having to execute the transformation over all of the input data. Caching / memoization This package tries to make efficient use of memory by using iterators and lazy evaluation where possible.

However, some transformations cannot be done without building data structures, either in memory or on disk. An example is the function, which will either sort a table entirely in memory, or will sort the table in memory in chunks, writing chunks to disk and performing a final merge sort on the chunks. Which strategy is used will depend on the arguments passed into the function when it is called. In either case, the sorting can take some time, and if the sorted data will be used more than once, it is obviously undesirable to throw away the sorted data and start again from scratch each time.


It is better to cache (a.k.a., memoize) the sorted data, if possible, so it can be re-used. However, if a table upstream of the sort is mutable, there needs to be some way of discovering whether data have been changed since the last sort was performed, and hence whether the cached data are still fresh or not.

There are also cases where, even though data are generated in a purely iterative fashion, some programs may still want to cache some or all of the data. E.g., where data are calculated dynamically and are relatively expensive to compute, or require scanning many rows, or where data are being retrieved via a network and there is latency. Again, there needs to be some way of finding out whether cached data are fresh or not. To support caching, it is recommended (but not required) that table container objects also implement the cachetag method. This method should return an integer which changes whenever the table’s fields or data changes (i.e., a row iterator would yield a different sequence of items). All table objects implement this method, where applicable.

Note in particular that the functions, and return tables that implement the cachetag method, and that the implementation of cachetag in these cases depends on a checksum function operating on the underlying data file. By default, is used as the checksum function, which is cheap to compute but crude because it relies only on file name, size and time of modification, and on some systems this will not reveal changes within the same second that preserve file size. If you need a finer level of granularity, use either or instead. These can be passed in as arguments to, and, or can be set globally, e.g. import petl. Defaultsumfun = petl.

Adler32sum Care must be taken to ensure correct implementation of the cachetag method where a table is generating data dynamically from another table or tables. In these cases, the state of the upstream tables must be considered when generating a cachetag value. One strategy is to construct cachetag values by hashing the internal configuration attributes of a table, along with the cachetag values from any tables immediately upstream.

In some cases, it may be difficult to determine whether data have changed, e.g., where data are being retrieved from a database. In these cases it is suggested that table objects use a user-configurable time to live (TTL) to generate cachetag values. E.g., where a database table is updated once a day at most, a TTL of a few hours would enable data to be cached during an interactive session, which might improve usability for someone exploring the data or developing a transformation script. Using petl in interactive mode (experimental) New in version 0.5. The module petl.interactive provides all of the functions present in the root module, but with a couple of optimisations for use within an interactive session. The main optimisation is that some caching is done behind the scenes, so that by default the first 100 rows of any table are cached in memory the first time they are requested. This usually provides a better experience when building up a transformation pipeline one step at a time, where you are examining the outputs of each intermediate step as its written via.

Database V08 For Mac

I.e., as each new step is added and the output examined, as long as less than 100 rows are requested, only that new step will actually be executed, and none of the upstream transformations will be repeated, because the outputs from previous steps will have been cached. The default cache size can be changed by setting petl.interactive.cachesize to an integer value. Note also that, by default, the function is used to generate a representation of tables. So you don’t need to type, e.g.look(mytable), you can just type mytable. The default representation function can be changed by setting petl.interactive.representation, e.g., petl.interactive.representation = petl.see, or petl.interactive.representation = None to disable this behaviour. from petl import data table = 'foo', 'bar' 'a', 1 'b', 2 it = data ( table ) it.

Next 'a', 1 it. Next 'b', 2 Changed in version 0.3.

Positional arguments can be used to slice the data rows. The sliceargs are passed to. Dataslice ( table,.args ) Deprecated since version 0.3. Use instead, it supports slice arguments. Records ( table, missing=None ) Return an iterator over the data in the table, yielding each row as a dictionary of values indexed by field name.

class CustomField ( object ). Def init ( self, id, description ). Description = description. Def str ( self ).

Def repr ( self ). Return 'CustomField(%r,%r )'% ( self. Description ). table = CustomField ( 'foo', 'Get some foo.'

), CustomField ( 'bar', 'A lot of bar.' 'b', 2 header ( table ) CustomField('foo', 'Get some foo.' ), CustomField('bar', 'A lot of bar.' ) fieldnames ( table ) 'foo', 'bar' petl. Rowcount ( table ) Count the number of data rows in a table.

table = 'foo', 'bar' 'a' 'b', 2, True look ( table ) +-+-+-+ 'foo' 'bar' 'a' +-+-+-+ 'b' 2 True +-+-+-+ Changed in version 0.3. Positional arguments can be used to slice the data rows. The sliceargs are passed to. Changed in version 0.8. The properties n and p can be used to look at the next and previous rows respectively.

I.e., try look(table) then.n` then.p. Lookall ( table ) Format the entire table as text for inspection in an interactive session. N.B., this will load the entire table into memory. See ( table,.sliceargs ) Format a portion of a table as text in a column-oriented layout for inspection in an interactive session. from petl import itervalues table = 'foo', 'bar' 'a', True 'b' 'b', True 'c', False foo = itervalues ( table, 'foo' ) foo. Next 'a' foo.

Next 'b' foo. Next 'b' foo. Next 'c' foo. Next Traceback (most recent call last): File ', line 1, in StopIteration The field argument can be a single field name or index (starting from zero) or a tuple of field names and/or indexes. If rows are uneven, the value of the keyword argument missing is returned.

More than one field can be selected, e.g. table = 'foo', 'bar', 'baz'.

1, 'a', True. 2, 'bb', True. 3, 'd', False foobaz = itervalues ( table, ( 'foo', 'baz' )) foobaz.


Next (1, True) foobaz. Next (2, True) foobaz. Next (3, False) foobaz. Next Traceback (most recent call last): File ', line 1, in StopIteration Changed in version 0.3. Positional arguments can be used to slice the data rows. The sliceargs are passed to. Changed in version 0.7.

In previous releases this function was known as ‘values’. Also in this release the behaviour with short rows is changed.

Now for any value missing due to a short row, None is returned by default, or whatever is given by the missing keyword argument. Values ( table, field,.sliceargs,.kwargs ) Return a container supporting iteration over values in a given field or fields. I.e., like only a container is returned so you can iterate over it multiple times. Changed in version 0.7. Now returns a container, previously returned an iterator. Valueset ( table, field ) Deprecated since version 0.3. Use set(values(table,.fields)) instead, see also.

Valuecount ( table, field, value ) Count the number of occurrences of value under the given field. Returns the absolute count and relative frequency as a pair. from petl import valuecount table = (( 'foo', 'bar' ), ( 'a', 1 ), ( 'b', 2 ), ( 'b', 7 )) n, f = valuecount ( table, 'foo', 'b' ) n 2 f 0.666666 The field argument can be a single field name or index (starting from zero) or a tuple of field names and/or indexes. Valuecounts ( table, field ) Find distinct values for the given field and count the number and relative frequency of occurrences. Returns a table mapping values to counts, with most common values first.

from petl import stringpatterns, look table = 'foo', 'bar'. Foo', '123-1254'. Bar', '234-1123'. Spo', '123-1254'.

Baz', u'321 1434'. Baz', u'321 1434'. Quux', '123-1254-XX' foopats = stringpatterns ( table, 'foo' ) look ( foopats ) +-+-+-+ 'pattern' 'count' 'frequency' 'Aa. Aaa' 3 0.5 +-+-+-+ 'Aaa. Aaa' 2 0.333333 +-+-+-+ 'Aa. Aaaa' 1 0.6666666 +-+-+-+ barpats = stringpatterns ( table, 'bar' ) look ( barpats ) +-+-+-+ 'pattern' 'count' 'frequency' '999-9999' 3 0.5 +-+-+-+ '999 9999' 2 0.333333 +-+-+-+ '999-9999-AA' 1 0.6666666 +-+-+-+ New in version 0.5. Stringpatterncounter ( table, field ) Profile string patterns in the given field, returning a mapping patterns to counts.

Database V08 For Mac

New in version 0.5. Rowlengths ( table ) Report on row lengths found in the table. from petl import look, rowlengths table = 'foo', 'bar', 'baz'. 'A', 1, 2. 'B', '2', '3.4'. u'B', u'3', u'7.8', True.

'D', 'xyz', 9.0. 'E', None. 'F', 9 look ( rowlengths ( table )) +-+-+ 'length' 'count' 3 3 +-+-+ 2 2 +-+-+ 4 1 +-+-+ petl.

Typecounts ( table, field ) Count the number of values found for each Python type and return a table mapping class names to counts and frequencies. from petl import look, typecounts table = 'foo', 'bar', 'baz'. 'A', 1, 2. 'B', u'2', '3.4'. u'B', u'3', u'7.8', True. 'D', u'xyz', 9.0.

from petl import timeparser isotime = timeparser ( '%H:%M:%S' ) isotime ( '00:00:00' ) datetime.time(0, 0) isotime ( '13:00:00' ) datetime.time(13, 0) isotime ( '12:00:99' ) Traceback (most recent call last): File ', line 1, in File 'petl/', line 1046, in parser File '/usr/lib/python2.7/', line 328, in strptime datastring found. End :) ValueError: unconverted data remains: 9 isotime ( '25:00:00' ) Traceback (most recent call last): File ', line 1, in File 'petl/', line 1046, in parser File '/usr/lib/python2.7/', line 325, in strptime ( datastring, format )) ValueError: time data '25:00:00' does not match format '%H:%M:%S' Can be used with, e.g. from petl import datetimeparser isodatetime = datetimeparser ( '%Y-%m-%d T%H:%M:%S' ) isodatetime ( '2002-12-25T00:00:00' ) datetime.datetime(2002, 12, 25, 0, 0) isodatetime ( '2002-12-25T00:00:99' ) Traceback (most recent call last): File ', line 1, in File 'petl/', line 1018, in parser return datetime. Strptime ( value. Strip , format ) File '/usr/lib/python2.7/', line 328, in strptime datastring found. End :) ValueError: unconverted data remains: 9 Can be used with, e.g.

This entry was posted on 03.11.2019.