• Stars
    star
    417
  • Rank 103,829 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A wrapper around asyncpg for use with sqlalchemy

Documentation Status

asyncpgsa

A python library wrapper around asyncpg for use with sqlalchemy

Backwards incompatibility notice

Since this library is still in pre 1.0 world, the api might change. I will do my best to minimize changes, and any changes that get added, I will mention here. You should lock the version for production apps.

  1. 0.9.0 changed the dialect from psycopg2 to pypostgres. This should be mostly backwards compatible, but if you notice weird issues, this is why. You can now plug-in your own dialect using pg.init(..., dialect=my_dialect), or setting the dialect on the pool. See the top of the connection file for an example of creating a dialect. Please let me know if the change from psycopg2 to pypostgres broke you. If this happens enough, I might make psycopg2 the default.

  2. 0.18.0 Removes the Record Proxy objects that would wrap asyncpg's records. Now asyncpgsa just returns whatever asyncpg would return. This is a HUGE backwards incompatible change but most people just used record._data to get the object directly anyways. This means dot notation for columns is no longer possible and you need to access columns using exact names with dictionary notation.

  3. 0.18.0 Removed the insert method. We found this method was just confusing, and useless as SqlAlchemy can do it for you by defining your table with a primary key.

  4. 0.27.0 Now only compatible with version 0.22.0 and greater of asyncpg.

sqlalchemy ORM

Currently this repo does not support SA ORM, only SA Core.

As we at canopy do not use the ORM, if you would like to have ORM support feel free to PR it. You would need to create an "engine" interface, and that should be it. Then you can bind your sessions to the engine.

sqlalchemy Core

This repo supports sqlalchemy core. Go here for examples.

Docs

Go here for docs.

Examples

Go here for examples.

install

pip install asyncpgsa

Note: You should not have asyncpg in your requirements at all. This lib will pull down the correct version of asyncpg for you. If you have asyncpg in your requirements, you could get a version newer than this one supports.

Contributing

To contribute or build this locally see contributing.md

FAQ

Does SQLAlchemy integration defeat the point of using asyncpg as a backend (performance)?

I dont think so. asyncpgsa is written in a way where any query can be a string instead of an SA object, then you will get near asyncpg speeds, as no SA code is ran.

However, when running SA queries, comparing this to aiopg, it still seams to work faster. Here is a very basic timeit test comparing the two. https://gist.github.com/nhumrich/3470f075ae1d868f663b162d01a07838

aiopg.sa: 9.541276566000306
asyncpsa: 6.747777451004367

So, seems like its still faster using asyncpg, or in otherwords, this library doesnt add any overhead that is not in aiopg.sa.

Versioning

This software follows Semantic Versioning.

More Repositories

1

sofe

Service Oriented Front-end
JavaScript
139
star
2

ckube

A cli to simplify working with kubectl for some common workflows
Go
132
star
3

bandicoot

React rich text editor
JavaScript
54
star
4

webpack-system-register

A webpack plugin that wraps your bundle in a System.register
JavaScript
36
star
5

kremling

Embarrassingly simple css for React
JavaScript
36
star
6

rxws

A RESTful Reactive JavaScript Implementation on top of Web Sockets
JavaScript
20
star
7

auto-trace

A library that fixes all your stack trace problems.
JavaScript
14
star
8

s3-file-auth

Require github auth for viewing your s3 files
Python
11
star
9

aiohttp-oauth

Oauth middlewear for your aiohttp app.
Python
11
star
10

cpr-multiselect

Canopy React Multi-select Component
JavaScript
11
star
11

Json-Query-Language

PHP
10
star
12

single-spa-canopy

Some helpers for single-spa child apps at canopy
JavaScript
10
star
13

use-once

A helper for running react effects only once
JavaScript
9
star
14

system-svelte

SystemJS plugin for compiling Svelte components
JavaScript
8
star
15

react-disposable-modal

A reactive API for building modal components in React
JavaScript
7
star
16

canopy-styleguide-old

Canopy Style Guide
JavaScript
7
star
17

frontend-rfc

6
star
18

async-decorator

Async tools for React provided by a decorator
JavaScript
6
star
19

node-jspm-jasmine

Run jasmine tests on a jspm project, without karma or phantomjs
JavaScript
6
star
20

cpr-mask

A react masking input component
JavaScript
6
star
21

pgbadger-rds-cron

A cron for parsing rds logs with pgbadger
Python
6
star
22

cronboss

Simple docker cron container for running commands in other docker container
Python
5
star
23

cpr-select

A consistently styled cross-browser and keyboard friendly select component
JavaScript
5
star
24

cp-dotfiles

Some dotfile setups for people who want a jump start on things like vim and tmux.
Vim Script
5
star
25

react-disposable-decorator

decorator for handling observables
JavaScript
5
star
26

kremling-loader

Build kremling css without ampersands
JavaScript
5
star
27

redux-phunk

A redux middleware to make your actions phunktional.
JavaScript
4
star
28

disposable-component

A simple reactive API for mounting and unmounting components to the DOM
JavaScript
4
star
29

kremling.js.org

The documentation website for kremling
3
star
30

sofe-babel-plugin

synchronous-sofe-loader
JavaScript
3
star
31

cpr-tooltip

a React tooltip for heart-threatening situations
JavaScript
3
star
32

sofe-inspector

A tool for managing sofe services
JavaScript
3
star
33

GradientNavigationBar

GradientNavigationBar is a drop in subclass of UINavigationBar that easily allows you to set the background to be a radial gradient.
Swift
3
star
34

cp-autoscale-input

An angular directive for auto sizing and input based upon the content within it
JavaScript
2
star
35

laramandrill

Laravel Mandrill plugin!
PHP
2
star
36

canopytax.github.io

Canopy Tech Blog
HTML
2
star
37

canopy-react-error-boundary

A higher order component / decorator for creating error boundaries in React code.
JavaScript
2
star
38

canopy-webpack-config

Some defaults for webpack configs at canopy
JavaScript
2
star
39

system-amd-script

SystemJS plugin for script loading sofe services
JavaScript
2
star
40

eslint-config-canopy

A standard eslint config for Canopy frontend developers
JavaScript
2
star
41

sofe-cssmodules

CSS Modules with Sofe
JavaScript
2
star
42

cp-select

A consistently styled cross-browser select component
JavaScript
1
star
43

JQL

Python implementation of JQL, with a spec.
1
star
44

cp-progress-slat

A consistently styled progress slat that confirms to the CanopyTax style guide.
HTML
1
star
45

localproxy

A local reverse proxy (such as nginx) for handling many local docker containers.
1
star
46

bandicoot.js.org

The bandicoot.js.org documentation website
1
star
47

minimal-node

A minimal nodejs container built on alpine linux
1
star
48

shade

A Code coverage tool
1
star
49

quip-service

PHP
1
star
50

sofe-worker

Service Oriented Front-end Implemented in a Service Worker
1
star
51

cp-tooltip

A simple tooltip widget for the canopy style guide
JavaScript
1
star
52

brillo

Simple electron IPC using promises
JavaScript
1
star
53

browserslist-config-canopy

Canopy's browsers list config
JavaScript
1
star
54

jest-string-object-serializer

A jest snapshot serializer for String objects
JavaScript
1
star
55

rxws-recorder

rxws middleware to help read websocket requests and responses.
JavaScript
1
star
56

bandicoot-starter

A starter repo for https://bandicoot.js.org
JavaScript
1
star
57

react-async-decorator

A decorator component for loading asynchronous data
1
star
58

aiohttp-github-auth

Github auth middlewear for your aiohttp app
Python
1
star
59

static-server

Just a repo for a static server docker image
Dockerfile
1
star
60

logspit

A docker container for aggregating logs.
Python
1
star
61

bs-time-pick

A time picker directive
JavaScript
1
star
62

ci-test

a dummy project for testing different ci's
Python
1
star
63

draftJS-renderer

A simple parser for draft.js output.
1
star
64

cpr-autoscale-input

A React component for auto sizing an input based on the content within it
JavaScript
1
star
65

cp-progress-bar

A consistently styled progress bar that confirms to the CanopyTax style guide.
HTML
1
star