Skip to main content

play sql

https://img.shields.io/pypi/v/play_sql.svg https://travis-ci.org/davidemoro/play_sql.svg?branch=develop Documentation Status https://codecov.io/gh/davidemoro/play_sql/branch/develop/graph/badge.svg

pytest-play support for SQL expressions and assertions

More info and examples on:

Features

This project defines a new pytest-play command:

- type: sql
  provider: play_sql
  database_url: postgresql://$db_user:$db_pwd@$db_host/$db_name
  query: SELECT id, title FROM invoices
  variable: invoice_id
  variable_expression: results.first()[0]
  assertion: invoice_id == $invoice_id

where:

  • database_url follows the format described http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls

  • variable_expression is a Python expression
    • results.fetchone() returns an array whose elements matches with the next row’s columns and it could be invoked many times until there will be no more rows (eg: first call (1, 'first',), second call (2, 'second'))

    • results.first() returns an array whose elements matches with the first row’s colums and it can be invoked exactly one time

    • results.fetchall() returns an array of tuples whose elements matches with the selected colums (eg: [(1, 'first'), (2, 'second'), (3, 'third')])

Twitter

pytest-play tweets happens here:

Credits

This package was created with Cookiecutter and the cookiecutter-play-plugin (based on audreyr/cookiecutter-pypackage project template).

CHANGES

0.0.3 (2019-01-25)

  • Supports new pytest-play >= 2.0 YAML based syntax (json no more supported)

0.0.2 (2018-01-22)

  • No more depends on play_python (deprecated)

0.0.1 (2018-01-11)

  • First release

Release files for play-sql 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for play-sql 0.0.3
File Size Uploaded
play_sql-0.0.3.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for play-sql 0.0.3
File Interpreter ABI Platform
play_sql-0.0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 25.6 kB

Release files / play_sql-0.0.3.tar.gz

Download URL play_sql-0.0.3.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7d429b4b7e76864d7eb146573e9e45a09a941717be88f111c8edb7818f175a63
BLAKE2b-256 checksum
How to use checksums
949df4871017109186d2d4436c53a2dd260fad8d05a3cdfb3598e0e413de68c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.6.7

Release files / play_sql-0.0.3-py2.py3-none-any.whl

Download URL play_sql-0.0.3-py2.py3-none-any.whl
Size 7.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c09c2b366a471678b2b241501780963ec6325bb9040726856073d78aa13615b1
BLAKE2b-256 checksum
How to use checksums
ab10e09f11cd35e289245f875adb7abe7defb3d7cae99c7af6519b7f7530f58e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.6.7

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page