Metadata-Version: 1.0
Name: slate_db
Version: 0.1
Summary: Wrapper for working with Slate databases.
Home-page: https://github.com/jamie-r-davis/slate_db
Author: Jamie Davis
Author-email: jamjam@umich.edu
License: MIT
Description: # Slate DB
        A Python wrapper for executing Slate Custom SQL in Python.
        
        ## Installation
        You must first install the [ODBC Driver for SQL Server](https://docs.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2017).
        
        Then install via pip:
        ```
        pip install git+https://github.com/jamie-r-davis/slate_db
        ```
        
        ## Usage
        The `SlateDB.select` method returns a generator which will yield any records that match your `sql` query. By default, each record is returned as a native `pyodbc` row, so columns can be accessed as attributes:
        
        ```python
        >>> from slate_db import SlateDB
        >>> db = SlateDB(server='your.server.com',
                         port=1441,
                         db='dbname-test',
                         username='user',
                         password='secret-password')
                     
        # select all records with last name "Smith"
        >>> sql = """select * from person where last = 'Smith'"""
        >>> for record in db.select(sql):
        >>>     print("{} <{}>".format(record.name, record.email))
        # Smith, John <john.smith@example.com>
        # Smith, Granny <granny.smith@example.com> 
        ```
        
        Rows can also be returned as dicts with the `as_dict` parameter:
        
        ```python
        >>> list(db.select(sql, as_dict=True))
        # [
        #   {
        #     "name": "Smith, Granny",
        #     "email": "granny.smith@example.com
        #   },
        #   {
        #     "name": "Smith, John",
        #     "email": "john.smith@example.com
        #   },
        #   ...
        # ]
        ```
Platform: UNKNOWN
