Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    relations 0.0.2

    Download button

    No screenshots available
    Downloads: 78  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Zachary Voase | More programs
    Public Domain / FREE
    January 24th, 2012, 12:45 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    relations description

    A tiny relational algebra engine for Python

    relations is a simple Python implementation of a relational algebra engine.

    Example

    Create a relation with a heading (i.e. a list of field names):

    >>> import relations
    >>> employees = relations.Relation('employee_name', 'dept_name')
    >>> employees
    < Relation('dept_name', 'employee_name') >


    The fields are re-ordered alphabetically, so that the order of values in tuples is consistent between equivalent but separate relations. Add tuples to the relation:

    >>> alice = employees.add(employee_name='Alice', dept_name='Finance')
    >>> bob = employees.add(employee_name='Bob', dept_name='Sales')
    >>> len(employees)
    2


    A relation is a set; duplicate tuples are considered identical:

    >>> _ = employees.add(employee_name='Alice', dept_name='Finance')
    >>> len(employees)
    2


    A relation implements the relational algebra, including the unary operators Select:

    >>> finance_emps = employees.select(lambda emp: emp.dept_name == 'Finance')
    >>> len(finance_emps)
    1


    Project:

    >>> names = employees.project('employee_name')
    >>> names.contains(employee_name='Bob')
    True
    >>> names.contains(employee_name='Charlie')
    False


    and Rename:

    >>> employees_renamed = employees.rename(name='employee_name')
    >>> employees_renamed.contains(name='Bob')
    True


    It also supports the set operations Union, Intersection and Difference.


    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    relational algebra | Python library | Python | relational | algebra

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM