fastasyncpg 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastasyncpg-0.0.1/LICENSE +201 -0
- fastasyncpg-0.0.1/MANIFEST.in +5 -0
- fastasyncpg-0.0.1/PKG-INFO +86 -0
- fastasyncpg-0.0.1/README.md +67 -0
- fastasyncpg-0.0.1/fastasyncpg/__init__.py +1 -0
- fastasyncpg-0.0.1/fastasyncpg/_modidx.py +93 -0
- fastasyncpg-0.0.1/fastasyncpg/core.py +547 -0
- fastasyncpg-0.0.1/fastasyncpg.egg-info/PKG-INFO +86 -0
- fastasyncpg-0.0.1/fastasyncpg.egg-info/SOURCES.txt +13 -0
- fastasyncpg-0.0.1/fastasyncpg.egg-info/dependency_links.txt +1 -0
- fastasyncpg-0.0.1/fastasyncpg.egg-info/entry_points.txt +2 -0
- fastasyncpg-0.0.1/fastasyncpg.egg-info/requires.txt +3 -0
- fastasyncpg-0.0.1/fastasyncpg.egg-info/top_level.txt +1 -0
- fastasyncpg-0.0.1/pyproject.toml +31 -0
- fastasyncpg-0.0.1/setup.cfg +4 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2022, fastai
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastasyncpg
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A simple wrapper for asyncpg
|
|
5
|
+
Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Repository, https://github.com/AnswerDotAI/fastasyncpg
|
|
8
|
+
Project-URL: Documentation, https://AnswerDotAI.github.io/fastasyncpg/
|
|
9
|
+
Keywords: nbdev
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: asyncpg
|
|
16
|
+
Requires-Dist: fastcore
|
|
17
|
+
Requires-Dist: sqlparse
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# fastasyncpg
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
24
|
+
|
|
25
|
+
This file will become your README and also the index of your
|
|
26
|
+
documentation.
|
|
27
|
+
|
|
28
|
+
## Developer Guide
|
|
29
|
+
|
|
30
|
+
If you are new to using `nbdev` here are some useful pointers to get you
|
|
31
|
+
started.
|
|
32
|
+
|
|
33
|
+
### Install fastasyncpg in Development mode
|
|
34
|
+
|
|
35
|
+
``` sh
|
|
36
|
+
# make sure fastasyncpg package is installed in development mode
|
|
37
|
+
$ pip install -e .
|
|
38
|
+
|
|
39
|
+
# make changes under nbs/ directory
|
|
40
|
+
# ...
|
|
41
|
+
|
|
42
|
+
# compile to have changes apply to fastasyncpg
|
|
43
|
+
$ nbdev_prepare
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
### Installation
|
|
49
|
+
|
|
50
|
+
Install latest from the GitHub
|
|
51
|
+
[repository](https://github.com/AnswerDotAI/fastasyncpg):
|
|
52
|
+
|
|
53
|
+
``` sh
|
|
54
|
+
$ pip install git+https://github.com/AnswerDotAI/fastasyncpg.git
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
or from [conda](https://anaconda.org/AnswerDotAI/fastasyncpg)
|
|
58
|
+
|
|
59
|
+
``` sh
|
|
60
|
+
$ conda install -c AnswerDotAI fastasyncpg
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
or from [pypi](https://pypi.org/project/fastasyncpg/)
|
|
64
|
+
|
|
65
|
+
``` sh
|
|
66
|
+
$ pip install fastasyncpg
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Documentation
|
|
70
|
+
|
|
71
|
+
Documentation can be found hosted on this GitHub
|
|
72
|
+
[repository](https://github.com/AnswerDotAI/fastasyncpg)’s
|
|
73
|
+
[pages](https://AnswerDotAI.github.io/fastasyncpg/). Additionally you
|
|
74
|
+
can find package manager specific guidelines on
|
|
75
|
+
[conda](https://anaconda.org/AnswerDotAI/fastasyncpg) and
|
|
76
|
+
[pypi](https://pypi.org/project/fastasyncpg/) respectively.
|
|
77
|
+
|
|
78
|
+
## How to use
|
|
79
|
+
|
|
80
|
+
Fill me in please! Don’t forget code examples:
|
|
81
|
+
|
|
82
|
+
``` python
|
|
83
|
+
1+1
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
2
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# fastasyncpg
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
5
|
+
|
|
6
|
+
This file will become your README and also the index of your
|
|
7
|
+
documentation.
|
|
8
|
+
|
|
9
|
+
## Developer Guide
|
|
10
|
+
|
|
11
|
+
If you are new to using `nbdev` here are some useful pointers to get you
|
|
12
|
+
started.
|
|
13
|
+
|
|
14
|
+
### Install fastasyncpg in Development mode
|
|
15
|
+
|
|
16
|
+
``` sh
|
|
17
|
+
# make sure fastasyncpg package is installed in development mode
|
|
18
|
+
$ pip install -e .
|
|
19
|
+
|
|
20
|
+
# make changes under nbs/ directory
|
|
21
|
+
# ...
|
|
22
|
+
|
|
23
|
+
# compile to have changes apply to fastasyncpg
|
|
24
|
+
$ nbdev_prepare
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### Installation
|
|
30
|
+
|
|
31
|
+
Install latest from the GitHub
|
|
32
|
+
[repository](https://github.com/AnswerDotAI/fastasyncpg):
|
|
33
|
+
|
|
34
|
+
``` sh
|
|
35
|
+
$ pip install git+https://github.com/AnswerDotAI/fastasyncpg.git
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
or from [conda](https://anaconda.org/AnswerDotAI/fastasyncpg)
|
|
39
|
+
|
|
40
|
+
``` sh
|
|
41
|
+
$ conda install -c AnswerDotAI fastasyncpg
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
or from [pypi](https://pypi.org/project/fastasyncpg/)
|
|
45
|
+
|
|
46
|
+
``` sh
|
|
47
|
+
$ pip install fastasyncpg
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Documentation
|
|
51
|
+
|
|
52
|
+
Documentation can be found hosted on this GitHub
|
|
53
|
+
[repository](https://github.com/AnswerDotAI/fastasyncpg)’s
|
|
54
|
+
[pages](https://AnswerDotAI.github.io/fastasyncpg/). Additionally you
|
|
55
|
+
can find package manager specific guidelines on
|
|
56
|
+
[conda](https://anaconda.org/AnswerDotAI/fastasyncpg) and
|
|
57
|
+
[pypi](https://pypi.org/project/fastasyncpg/) respectively.
|
|
58
|
+
|
|
59
|
+
## How to use
|
|
60
|
+
|
|
61
|
+
Fill me in please! Don’t forget code examples:
|
|
62
|
+
|
|
63
|
+
``` python
|
|
64
|
+
1+1
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.1"
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Autogenerated by nbdev
|
|
2
|
+
|
|
3
|
+
d = { 'settings': { 'branch': 'main',
|
|
4
|
+
'doc_baseurl': '/fastasyncpg',
|
|
5
|
+
'doc_host': 'https://AnswerDotAI.github.io',
|
|
6
|
+
'git_url': 'https://github.com/AnswerDotAI/fastasyncpg',
|
|
7
|
+
'lib_path': 'fastasyncpg'},
|
|
8
|
+
'syms': { 'fastasyncpg.core': { 'fastasyncpg.core.Database': ('core.html#database', 'fastasyncpg/core.py'),
|
|
9
|
+
'fastasyncpg.core.Database.__getattr__': ('core.html#database.__getattr__', 'fastasyncpg/core.py'),
|
|
10
|
+
'fastasyncpg.core.Database.__init__': ('core.html#database.__init__', 'fastasyncpg/core.py'),
|
|
11
|
+
'fastasyncpg.core.Database.__str__': ('core.html#database.__str__', 'fastasyncpg/core.py'),
|
|
12
|
+
'fastasyncpg.core.Database._retr_tbl': ('core.html#database._retr_tbl', 'fastasyncpg/core.py'),
|
|
13
|
+
'fastasyncpg.core.Database.create': ('core.html#database.create', 'fastasyncpg/core.py'),
|
|
14
|
+
'fastasyncpg.core.Database.get_tables': ('core.html#database.get_tables', 'fastasyncpg/core.py'),
|
|
15
|
+
'fastasyncpg.core.Database.item': ('core.html#database.item', 'fastasyncpg/core.py'),
|
|
16
|
+
'fastasyncpg.core.Database.link_dcs': ('core.html#database.link_dcs', 'fastasyncpg/core.py'),
|
|
17
|
+
'fastasyncpg.core.Database.q': ('core.html#database.q', 'fastasyncpg/core.py'),
|
|
18
|
+
'fastasyncpg.core.Database.refresh': ('core.html#database.refresh', 'fastasyncpg/core.py'),
|
|
19
|
+
'fastasyncpg.core.Database.set_classes': ('core.html#database.set_classes', 'fastasyncpg/core.py'),
|
|
20
|
+
'fastasyncpg.core.Database.t': ('core.html#database.t', 'fastasyncpg/core.py'),
|
|
21
|
+
'fastasyncpg.core.Database.table': ('core.html#database.table', 'fastasyncpg/core.py'),
|
|
22
|
+
'fastasyncpg.core.Database.table2glb': ('core.html#database.table2glb', 'fastasyncpg/core.py'),
|
|
23
|
+
'fastasyncpg.core.FRecord': ('core.html#frecord', 'fastasyncpg/core.py'),
|
|
24
|
+
'fastasyncpg.core.FRecord.__getattr__': ('core.html#frecord.__getattr__', 'fastasyncpg/core.py'),
|
|
25
|
+
'fastasyncpg.core.FRecord._repr_html_': ('core.html#frecord._repr_html_', 'fastasyncpg/core.py'),
|
|
26
|
+
'fastasyncpg.core.NotFoundError': ('core.html#notfounderror', 'fastasyncpg/core.py'),
|
|
27
|
+
'fastasyncpg.core.Results': ('core.html#results', 'fastasyncpg/core.py'),
|
|
28
|
+
'fastasyncpg.core.Results._repr_html_': ('core.html#results._repr_html_', 'fastasyncpg/core.py'),
|
|
29
|
+
'fastasyncpg.core.Table': ('core.html#table', 'fastasyncpg/core.py'),
|
|
30
|
+
'fastasyncpg.core.Table.__call__': ('core.html#table.__call__', 'fastasyncpg/core.py'),
|
|
31
|
+
'fastasyncpg.core.Table.__getitem__': ('core.html#table.__getitem__', 'fastasyncpg/core.py'),
|
|
32
|
+
'fastasyncpg.core.Table.__init__': ('core.html#table.__init__', 'fastasyncpg/core.py'),
|
|
33
|
+
'fastasyncpg.core.Table.__repr__': ('core.html#table.__repr__', 'fastasyncpg/core.py'),
|
|
34
|
+
'fastasyncpg.core.Table.__str__': ('core.html#table.__str__', 'fastasyncpg/core.py'),
|
|
35
|
+
'fastasyncpg.core.Table.c': ('core.html#table.c', 'fastasyncpg/core.py'),
|
|
36
|
+
'fastasyncpg.core.Table.cols': ('core.html#table.cols', 'fastasyncpg/core.py'),
|
|
37
|
+
'fastasyncpg.core.Table.count': ('core.html#table.count', 'fastasyncpg/core.py'),
|
|
38
|
+
'fastasyncpg.core.Table.count_where': ('core.html#table.count_where', 'fastasyncpg/core.py'),
|
|
39
|
+
'fastasyncpg.core.Table.delete': ('core.html#table.delete', 'fastasyncpg/core.py'),
|
|
40
|
+
'fastasyncpg.core.Table.delete_where': ('core.html#table.delete_where', 'fastasyncpg/core.py'),
|
|
41
|
+
'fastasyncpg.core.Table.drop': ('core.html#table.drop', 'fastasyncpg/core.py'),
|
|
42
|
+
'fastasyncpg.core.Table.get': ('core.html#table.get', 'fastasyncpg/core.py'),
|
|
43
|
+
'fastasyncpg.core.Table.insert': ('core.html#table.insert', 'fastasyncpg/core.py'),
|
|
44
|
+
'fastasyncpg.core.Table.pks': ('core.html#table.pks', 'fastasyncpg/core.py'),
|
|
45
|
+
'fastasyncpg.core.Table.pks_and_rows_where': ( 'core.html#table.pks_and_rows_where',
|
|
46
|
+
'fastasyncpg/core.py'),
|
|
47
|
+
'fastasyncpg.core.Table.rows_where': ('core.html#table.rows_where', 'fastasyncpg/core.py'),
|
|
48
|
+
'fastasyncpg.core.Table.selectone': ('core.html#table.selectone', 'fastasyncpg/core.py'),
|
|
49
|
+
'fastasyncpg.core.Table.update': ('core.html#table.update', 'fastasyncpg/core.py'),
|
|
50
|
+
'fastasyncpg.core.Table.upsert': ('core.html#table.upsert', 'fastasyncpg/core.py'),
|
|
51
|
+
'fastasyncpg.core.Table.xtra': ('core.html#table.xtra', 'fastasyncpg/core.py'),
|
|
52
|
+
'fastasyncpg.core._Col': ('core.html#_col', 'fastasyncpg/core.py'),
|
|
53
|
+
'fastasyncpg.core._Col.__init__': ('core.html#_col.__init__', 'fastasyncpg/core.py'),
|
|
54
|
+
'fastasyncpg.core._Col.__iter__': ('core.html#_col.__iter__', 'fastasyncpg/core.py'),
|
|
55
|
+
'fastasyncpg.core._Col.__repr__': ('core.html#_col.__repr__', 'fastasyncpg/core.py'),
|
|
56
|
+
'fastasyncpg.core._Col.__str__': ('core.html#_col.__str__', 'fastasyncpg/core.py'),
|
|
57
|
+
'fastasyncpg.core._ColsGetter': ('core.html#_colsgetter', 'fastasyncpg/core.py'),
|
|
58
|
+
'fastasyncpg.core._ColsGetter.__call__': ('core.html#_colsgetter.__call__', 'fastasyncpg/core.py'),
|
|
59
|
+
'fastasyncpg.core._ColsGetter.__contains__': ( 'core.html#_colsgetter.__contains__',
|
|
60
|
+
'fastasyncpg/core.py'),
|
|
61
|
+
'fastasyncpg.core._ColsGetter.__dir__': ('core.html#_colsgetter.__dir__', 'fastasyncpg/core.py'),
|
|
62
|
+
'fastasyncpg.core._ColsGetter.__getattr__': ('core.html#_colsgetter.__getattr__', 'fastasyncpg/core.py'),
|
|
63
|
+
'fastasyncpg.core._ColsGetter.__init__': ('core.html#_colsgetter.__init__', 'fastasyncpg/core.py'),
|
|
64
|
+
'fastasyncpg.core._ColsGetter.__repr__': ('core.html#_colsgetter.__repr__', 'fastasyncpg/core.py'),
|
|
65
|
+
'fastasyncpg.core._Getter': ('core.html#_getter', 'fastasyncpg/core.py'),
|
|
66
|
+
'fastasyncpg.core._Getter.__contains__': ('core.html#_getter.__contains__', 'fastasyncpg/core.py'),
|
|
67
|
+
'fastasyncpg.core._Getter.__dir__': ('core.html#_getter.__dir__', 'fastasyncpg/core.py'),
|
|
68
|
+
'fastasyncpg.core._Getter.__getattr__': ('core.html#_getter.__getattr__', 'fastasyncpg/core.py'),
|
|
69
|
+
'fastasyncpg.core._Getter.__getitem__': ('core.html#_getter.__getitem__', 'fastasyncpg/core.py'),
|
|
70
|
+
'fastasyncpg.core._Getter.__init__': ('core.html#_getter.__init__', 'fastasyncpg/core.py'),
|
|
71
|
+
'fastasyncpg.core._Getter.__iter__': ('core.html#_getter.__iter__', 'fastasyncpg/core.py'),
|
|
72
|
+
'fastasyncpg.core._Getter.__repr__': ('core.html#_getter.__repr__', 'fastasyncpg/core.py'),
|
|
73
|
+
'fastasyncpg.core._TablesGetter': ('core.html#_tablesgetter', 'fastasyncpg/core.py'),
|
|
74
|
+
'fastasyncpg.core._TablesGetter.__init__': ('core.html#_tablesgetter.__init__', 'fastasyncpg/core.py'),
|
|
75
|
+
'fastasyncpg.core._add_xtra': ('core.html#_add_xtra', 'fastasyncpg/core.py'),
|
|
76
|
+
'fastasyncpg.core._dataclass': ('core.html#_dataclass', 'fastasyncpg/core.py'),
|
|
77
|
+
'fastasyncpg.core._get_flds': ('core.html#_get_flds', 'fastasyncpg/core.py'),
|
|
78
|
+
'fastasyncpg.core._pk_where': ('core.html#_pk_where', 'fastasyncpg/core.py'),
|
|
79
|
+
'fastasyncpg.core._prep_row': ('core.html#_prep_row', 'fastasyncpg/core.py'),
|
|
80
|
+
'fastasyncpg.core._process_row': ('core.html#_process_row', 'fastasyncpg/core.py'),
|
|
81
|
+
'fastasyncpg.core.all_dcs': ('core.html#all_dcs', 'fastasyncpg/core.py'),
|
|
82
|
+
'fastasyncpg.core.col_def': ('core.html#col_def', 'fastasyncpg/core.py'),
|
|
83
|
+
'fastasyncpg.core.columns_info': ('core.html#columns_info', 'fastasyncpg/core.py'),
|
|
84
|
+
'fastasyncpg.core.connect': ('core.html#connect', 'fastasyncpg/core.py'),
|
|
85
|
+
'fastasyncpg.core.conv_placeholders': ('core.html#conv_placeholders', 'fastasyncpg/core.py'),
|
|
86
|
+
'fastasyncpg.core.create_mod': ('core.html#create_mod', 'fastasyncpg/core.py'),
|
|
87
|
+
'fastasyncpg.core.create_pool': ('core.html#create_pool', 'fastasyncpg/core.py'),
|
|
88
|
+
'fastasyncpg.core.get_field': ('core.html#get_field', 'fastasyncpg/core.py'),
|
|
89
|
+
'fastasyncpg.core.get_typ': ('core.html#get_typ', 'fastasyncpg/core.py'),
|
|
90
|
+
'fastasyncpg.core.pk_cols': ('core.html#pk_cols', 'fastasyncpg/core.py'),
|
|
91
|
+
'fastasyncpg.core.setup_json': ('core.html#setup_json', 'fastasyncpg/core.py'),
|
|
92
|
+
'fastasyncpg.core.table_names': ('core.html#table_names', 'fastasyncpg/core.py'),
|
|
93
|
+
'fastasyncpg.core.view_names': ('core.html#view_names', 'fastasyncpg/core.py')}}}
|
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
|
|
2
|
+
|
|
3
|
+
# %% auto #0
|
|
4
|
+
__all__ = ['pg_to_py', 'py_to_pg', 'Results', 'FRecord', 'table_names', 'view_names', 'columns_info', 'pk_cols', 'Database',
|
|
5
|
+
'Table', 'conv_placeholders', 'get_typ', 'setup_json', 'connect', 'all_dcs', 'NotFoundError', 'get_field',
|
|
6
|
+
'create_mod', 'col_def', 'create_pool']
|
|
7
|
+
|
|
8
|
+
# %% ../nbs/00_core.ipynb #222d751e
|
|
9
|
+
from fastcore.utils import *
|
|
10
|
+
import asyncpg
|
|
11
|
+
from asyncpg import connection,protocol
|
|
12
|
+
|
|
13
|
+
# %% ../nbs/00_core.ipynb #cdb9cd9e
|
|
14
|
+
class Results(list):
|
|
15
|
+
def _repr_html_(self):
|
|
16
|
+
if not self: return ""
|
|
17
|
+
ks = list(self[0].keys())
|
|
18
|
+
ths = "".join(f"<th>{k}</th>" for k in ks)
|
|
19
|
+
trs = "".join(f"<tr>{''.join(f'<td>{v}</td>' for v in r.values())}</tr>" for r in self)
|
|
20
|
+
return f'<table class="prose"><thead><tr>{ths}</tr></thead><tbody>{trs}</tbody></table>'
|
|
21
|
+
|
|
22
|
+
# %% ../nbs/00_core.ipynb #25f59343
|
|
23
|
+
from asyncpg.protocol.record import Record
|
|
24
|
+
|
|
25
|
+
# %% ../nbs/00_core.ipynb #e9a012cd
|
|
26
|
+
class FRecord(Record):
|
|
27
|
+
def __getattr__(self, k):
|
|
28
|
+
if k.startswith('_'): raise AttributeError(k)
|
|
29
|
+
return self[k]
|
|
30
|
+
|
|
31
|
+
def _repr_html_(self):
|
|
32
|
+
rows = "".join(f"<tr><td>{k}</td><td>{v}</td></tr>" for k,v in self.items())
|
|
33
|
+
return f'<table class="prose"><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody>{rows}</tbody></table>'
|
|
34
|
+
|
|
35
|
+
# %% ../nbs/00_core.ipynb #7c604795
|
|
36
|
+
async def table_names(conn, schema='public'):
|
|
37
|
+
"List of table names in `schema`"
|
|
38
|
+
res = await conn.fetch("""
|
|
39
|
+
SELECT c.relname FROM pg_class c
|
|
40
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
41
|
+
WHERE n.nspname = $1 AND c.relkind = 'r' AND NOT c.relname LIKE 'pg_%'""", schema)
|
|
42
|
+
return [r['relname'] for r in res]
|
|
43
|
+
|
|
44
|
+
async def view_names(conn, schema='public'):
|
|
45
|
+
"List of view names in `schema`"
|
|
46
|
+
res = await conn.fetch("""
|
|
47
|
+
SELECT c.relname FROM pg_class c
|
|
48
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
49
|
+
WHERE n.nspname = $1 AND c.relkind = 'v'""", schema)
|
|
50
|
+
return [r['relname'] for r in res]
|
|
51
|
+
|
|
52
|
+
# %% ../nbs/00_core.ipynb #29cf6d50
|
|
53
|
+
async def columns_info(conn, table, schema='public'):
|
|
54
|
+
"Dict mapping column names to data types for `table`"
|
|
55
|
+
res = await conn.fetch("""
|
|
56
|
+
SELECT a.attname, format_type(a.atttypid, a.atttypmod) as data_type
|
|
57
|
+
FROM pg_attribute a
|
|
58
|
+
JOIN pg_class c ON c.oid = a.attrelid
|
|
59
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
60
|
+
WHERE n.nspname = $1 AND c.relname = $2 AND a.attnum > 0 AND NOT a.attisdropped
|
|
61
|
+
ORDER BY a.attnum""", schema, table)
|
|
62
|
+
return {r['attname']: r['data_type'] for r in res}
|
|
63
|
+
|
|
64
|
+
# %% ../nbs/00_core.ipynb #f504a98b
|
|
65
|
+
async def pk_cols(conn, table):
|
|
66
|
+
"Get primary key column(s) for `table`"
|
|
67
|
+
res = await conn.fetch("""
|
|
68
|
+
SELECT a.attname FROM pg_index i
|
|
69
|
+
JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey)
|
|
70
|
+
WHERE i.indrelid = $1::regclass AND i.indisprimary""", table)
|
|
71
|
+
return [r['attname'] for r in res]
|
|
72
|
+
|
|
73
|
+
# %% ../nbs/00_core.ipynb #350e6168
|
|
74
|
+
class Database:
|
|
75
|
+
def __init__(self, conn, refresh=True):
|
|
76
|
+
self.conn = conn
|
|
77
|
+
self._tnames,self._vnames = [],[]
|
|
78
|
+
self._tables = {}
|
|
79
|
+
if refresh: asyncio.create_task(self.refresh())
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def t(self):
|
|
83
|
+
if not hasattr(self, '_t'): self._t = _TablesGetter(self)
|
|
84
|
+
return self._t
|
|
85
|
+
|
|
86
|
+
def __getattr__(self, k): return getattr(self.conn, k)
|
|
87
|
+
|
|
88
|
+
def table(self, name):
|
|
89
|
+
if name not in self._tables: self._tables[name] = Table(self, name)
|
|
90
|
+
return self._tables[name]
|
|
91
|
+
|
|
92
|
+
async def refresh(self):
|
|
93
|
+
"Refresh all metadata"
|
|
94
|
+
self._tnames,self._vnames = await table_names(self),await view_names(self)
|
|
95
|
+
self._cols = {o: (await columns_info(self, o)) for o in self._tnames+self._vnames}
|
|
96
|
+
self._pks = {o: (await pk_cols(self, o)) for o in self._tnames}
|
|
97
|
+
|
|
98
|
+
def __str__(self):
|
|
99
|
+
if isinstance(self.conn, asyncpg.pool.Pool):
|
|
100
|
+
kw = self.conn._connect_kwargs
|
|
101
|
+
u,h,d,p = kw.get('user','postgres'), kw.get('host','localhost'), kw.get('database','postgres'), kw.get('port',5432)
|
|
102
|
+
else:
|
|
103
|
+
pr,a = self.conn._params, self.conn._addr
|
|
104
|
+
u,h,d,p = pr.user, a[0], pr.database, a[1]
|
|
105
|
+
return f"postgresql://{u}@{h}:{p}/{d}"
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# %% ../nbs/00_core.ipynb #ae461a23
|
|
109
|
+
class Table:
|
|
110
|
+
def __init__(self, db, name):
|
|
111
|
+
store_attr()
|
|
112
|
+
self.xtra_id = {}
|
|
113
|
+
|
|
114
|
+
@property
|
|
115
|
+
def cols(self): return self.db._cols.get(self.name, {})
|
|
116
|
+
def __repr__(self): return f'Table "{self.name}"'
|
|
117
|
+
def __str__(self): return f'"{self.name}"'
|
|
118
|
+
|
|
119
|
+
def xtra(self, **kwargs):
|
|
120
|
+
"Set extra constraints for queries/inserts"
|
|
121
|
+
self.xtra_id = kwargs
|
|
122
|
+
return self
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def pks(self): return self.db._pks.get(self.name, [])
|
|
126
|
+
|
|
127
|
+
# %% ../nbs/00_core.ipynb #c0374b56
|
|
128
|
+
class _Getter:
|
|
129
|
+
def __init__(self, db, attr): self.db,self.attr = db,attr
|
|
130
|
+
|
|
131
|
+
def __repr__(self): return ", ".join(getattr(self.db, self.attr))
|
|
132
|
+
def __dir__(self): return getattr(self.db, self.attr)
|
|
133
|
+
def __iter__(self): return iter(self[dir(self)])
|
|
134
|
+
def __contains__(self, s): return (s if isinstance(s,str) else s.name) in dir(self)
|
|
135
|
+
def __getitem__(self, idxs):
|
|
136
|
+
if isinstance(idxs,str): return self.db.table(idxs)
|
|
137
|
+
return [self.db.table(o) for o in idxs]
|
|
138
|
+
def __getattr__(self, k):
|
|
139
|
+
if k.startswith('_'): raise AttributeError
|
|
140
|
+
return self.db.table(k)
|
|
141
|
+
|
|
142
|
+
class _TablesGetter(_Getter):
|
|
143
|
+
def __init__(self, db): super().__init__(db,'_tnames')
|
|
144
|
+
|
|
145
|
+
# %% ../nbs/00_core.ipynb #699ea455
|
|
146
|
+
class _Col:
|
|
147
|
+
def __init__(self, t, c): self.t,self.c = t,c
|
|
148
|
+
def __str__(self): return f'"{self.t}"."{self.c}"'
|
|
149
|
+
def __repr__(self): return self.c
|
|
150
|
+
def __iter__(self): return iter(self.c)
|
|
151
|
+
|
|
152
|
+
class _ColsGetter:
|
|
153
|
+
def __init__(self, tbl): self.tbl = tbl
|
|
154
|
+
def __dir__(self): return list(self.tbl.cols)
|
|
155
|
+
def __repr__(self): return ", ".join(dir(self))
|
|
156
|
+
def __call__(self): return [_Col(self.tbl.name,o.name) for o in self.tbl.columns]
|
|
157
|
+
def __contains__(self, s): return (s if isinstance(s,str) else s.c) in self.tbl.cols
|
|
158
|
+
def __getattr__(self, k):
|
|
159
|
+
if k[0]=='_': raise AttributeError
|
|
160
|
+
return _Col(self.tbl.name, k)
|
|
161
|
+
|
|
162
|
+
@patch(as_prop=True)
|
|
163
|
+
def c(self:Table): return _ColsGetter(self)
|
|
164
|
+
|
|
165
|
+
# %% ../nbs/00_core.ipynb #c6a5d503
|
|
166
|
+
import sqlparse
|
|
167
|
+
from itertools import count
|
|
168
|
+
from sqlparse import tokens
|
|
169
|
+
|
|
170
|
+
# %% ../nbs/00_core.ipynb #1ca2b1b9
|
|
171
|
+
def conv_placeholders(sql):
|
|
172
|
+
"Convert `?` placeholders to PostgreSQL `$n` style"
|
|
173
|
+
if '?' not in sql: return sql
|
|
174
|
+
c = count(1)
|
|
175
|
+
def _convpl1(s):
|
|
176
|
+
return ''.join(f'${next(c)}' if t.ttype is tokens.Name.Placeholder and t.value=='?' else t.value for t in s.flatten())
|
|
177
|
+
return ''.join([_convpl1(s) for s in sqlparse.parse(sql)])
|
|
178
|
+
|
|
179
|
+
# %% ../nbs/00_core.ipynb #ceeb54fb
|
|
180
|
+
@patch
|
|
181
|
+
async def q(self:Database, sql, *args):
|
|
182
|
+
csql = conv_placeholders(sql)
|
|
183
|
+
return Results(await self.fetch(csql, *args))
|
|
184
|
+
|
|
185
|
+
# %% ../nbs/00_core.ipynb #0fc7310b
|
|
186
|
+
from datetime import datetime, date, time, timedelta
|
|
187
|
+
from decimal import Decimal
|
|
188
|
+
from uuid import UUID
|
|
189
|
+
from ipaddress import IPv4Network, IPv6Network, IPv4Interface, IPv6Interface, IPv4Address, IPv6Address
|
|
190
|
+
from asyncpg.types import Range, BitString, Box, Circle, Line, LineSegment, Path, Point, Polygon
|
|
191
|
+
|
|
192
|
+
# %% ../nbs/00_core.ipynb #a559e812
|
|
193
|
+
def get_typ(pg_type):
|
|
194
|
+
"Get Python type for PostgreSQL type string"
|
|
195
|
+
return pg_to_py[pg_type.split('(')[0].strip()]
|
|
196
|
+
|
|
197
|
+
# %% ../nbs/00_core.ipynb #a17706fc
|
|
198
|
+
pg_to_py = {
|
|
199
|
+
'smallint': int, 'integer': int, 'bigint': int,
|
|
200
|
+
'real': float, 'float': float, 'double precision': float,
|
|
201
|
+
'numeric': Decimal, 'decimal': Decimal,
|
|
202
|
+
|
|
203
|
+
'char': str, 'character': str, 'name': str, 'varchar': str, 'character varying': str, 'text': str, 'xml': str,
|
|
204
|
+
'bytea': bytes,
|
|
205
|
+
'boolean': bool, 'bool': bool,
|
|
206
|
+
|
|
207
|
+
'date': date,
|
|
208
|
+
'time': time, 'time without time zone': time, 'time with time zone': time,
|
|
209
|
+
'timestamp': datetime, 'timestamp without time zone': datetime, 'timestamp with time zone': datetime,
|
|
210
|
+
'interval': timedelta,
|
|
211
|
+
|
|
212
|
+
'uuid': UUID,
|
|
213
|
+
'json': dict, 'jsonb': dict,
|
|
214
|
+
'money': str,
|
|
215
|
+
'macaddr': str,
|
|
216
|
+
|
|
217
|
+
'cidr': IPv4Network, 'inet': IPv4Interface,
|
|
218
|
+
|
|
219
|
+
'bit': BitString, 'varbit': BitString,
|
|
220
|
+
'box': Box, 'circle': Circle, 'line': Line, 'lseg': LineSegment,
|
|
221
|
+
'path': Path, 'point': Point, 'polygon': Polygon,
|
|
222
|
+
|
|
223
|
+
'anyarray': list, 'ARRAY': list,
|
|
224
|
+
'anyrange': Range,
|
|
225
|
+
'record': tuple, 'tid': tuple,
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
# %% ../nbs/00_core.ipynb #a5c571d1
|
|
229
|
+
import json
|
|
230
|
+
|
|
231
|
+
# %% ../nbs/00_core.ipynb #9282bec2
|
|
232
|
+
async def setup_json(conn):
|
|
233
|
+
await conn.set_type_codec('json', encoder=json.dumps, decoder=json.loads, schema='pg_catalog')
|
|
234
|
+
await conn.set_type_codec('jsonb', encoder=json.dumps, decoder=json.loads, schema='pg_catalog')
|
|
235
|
+
|
|
236
|
+
# %% ../nbs/00_core.ipynb #e95ad25a
|
|
237
|
+
async def connect(*args, **kwargs):
|
|
238
|
+
kwargs.setdefault('record_class', FRecord)
|
|
239
|
+
conn = await asyncpg.connect(*args, **kwargs)
|
|
240
|
+
await setup_json(conn)
|
|
241
|
+
res = Database(conn, refresh=False)
|
|
242
|
+
await res.refresh()
|
|
243
|
+
return res
|
|
244
|
+
|
|
245
|
+
# %% ../nbs/00_core.ipynb #341b22b5
|
|
246
|
+
from dataclasses import dataclass, field, make_dataclass, fields, Field, is_dataclass, MISSING
|
|
247
|
+
|
|
248
|
+
# %% ../nbs/00_core.ipynb #8402e3b8
|
|
249
|
+
def _get_flds(tbl):
|
|
250
|
+
return [(k, get_typ(v)|None, field(default=UNSET))
|
|
251
|
+
for k,v in tbl.cols.items()]
|
|
252
|
+
|
|
253
|
+
def _dataclass(self:Table, store=True, suf='')->type:
|
|
254
|
+
"Create a `dataclass` with the types and defaults of this table"
|
|
255
|
+
res = make_dataclass(self.name.title()+suf, _get_flds(self))
|
|
256
|
+
flexiclass(res)
|
|
257
|
+
if store: self.cls = res
|
|
258
|
+
return res
|
|
259
|
+
|
|
260
|
+
Table.dataclass = _dataclass
|
|
261
|
+
|
|
262
|
+
# %% ../nbs/00_core.ipynb #cf91a162
|
|
263
|
+
def all_dcs(db, with_views=False, store=True, suf=''):
|
|
264
|
+
"dataclasses for all objects in `db`"
|
|
265
|
+
return [o.dataclass(store=store, suf=suf) for o in list(db.t) + (db.views if with_views else [])]
|
|
266
|
+
|
|
267
|
+
# %% ../nbs/00_core.ipynb #b37f834d
|
|
268
|
+
def _add_xtra(tbl, where, args, offset=0):
|
|
269
|
+
args = listify(args)
|
|
270
|
+
if not tbl.xtra_id: return where, args
|
|
271
|
+
xw = ' AND '.join(f'"{k}"=${len(args)+offset+i+1}' for i,k in enumerate(tbl.xtra_id))
|
|
272
|
+
where = f'({where}) AND {xw}' if where else xw
|
|
273
|
+
args.extend(tbl.xtra_id.values())
|
|
274
|
+
return where, args
|
|
275
|
+
|
|
276
|
+
# %% ../nbs/00_core.ipynb #de5874df
|
|
277
|
+
class NotFoundError(Exception): pass
|
|
278
|
+
|
|
279
|
+
@patch
|
|
280
|
+
async def __getitem__(self:Table, pk):
|
|
281
|
+
"Get row by primary key, raising NotFoundError if missing"
|
|
282
|
+
if not self.pks: raise ValueError(f"No primary key for {self.name}")
|
|
283
|
+
where, args = _add_xtra(self, f'"{self.pks[0]}" = $1', [pk])
|
|
284
|
+
return await self._rec(f'SELECT * FROM {self} WHERE {where}', *args, err=f"{self.name}[{pk}]")
|
|
285
|
+
|
|
286
|
+
# %% ../nbs/00_core.ipynb #76a582ae
|
|
287
|
+
@patch
|
|
288
|
+
async def get(self:Table, pk):
|
|
289
|
+
"Get row by primary key, or None if missing"
|
|
290
|
+
try: return await self[pk]
|
|
291
|
+
except NotFoundError: return None
|
|
292
|
+
|
|
293
|
+
# %% ../nbs/00_core.ipynb #fd2d38a2
|
|
294
|
+
@patch
|
|
295
|
+
async def rows_where(self:Table, where=None, where_args=None, order_by=None, select='*', limit=None, offset=None,
|
|
296
|
+
as_cls=True, debug=False):
|
|
297
|
+
"Iterate over rows matching where clause"
|
|
298
|
+
where, args = _add_xtra(self, where, where_args or [])
|
|
299
|
+
sql = f'SELECT {select} FROM {self}'
|
|
300
|
+
if where: sql += f' WHERE {where}'
|
|
301
|
+
if order_by: sql += f' ORDER BY {order_by}'
|
|
302
|
+
if limit: sql += f' LIMIT {limit}'
|
|
303
|
+
if offset: sql += f' OFFSET {offset}'
|
|
304
|
+
if debug: print(sql)
|
|
305
|
+
if as_cls: return await self._recs(sql, *args)
|
|
306
|
+
return await self.db.q(sql, *args)
|
|
307
|
+
|
|
308
|
+
# %% ../nbs/00_core.ipynb #b96b3f21
|
|
309
|
+
@patch
|
|
310
|
+
async def count_where(self:Table, where=None, where_args=None):
|
|
311
|
+
where, args = _add_xtra(self, where, where_args)
|
|
312
|
+
sql = f'SELECT COUNT(*) FROM {self}'
|
|
313
|
+
if where: sql += f' WHERE {where}'
|
|
314
|
+
return await self.db.fetchval(sql, *args)
|
|
315
|
+
|
|
316
|
+
# %% ../nbs/00_core.ipynb #481230b7
|
|
317
|
+
@patch(as_prop=True)
|
|
318
|
+
async def count(self:Table): return await self.count_where()
|
|
319
|
+
|
|
320
|
+
# %% ../nbs/00_core.ipynb #28682469
|
|
321
|
+
from collections.abc import Mapping
|
|
322
|
+
|
|
323
|
+
# %% ../nbs/00_core.ipynb #8ef66a0f
|
|
324
|
+
def get_field(r, k):
|
|
325
|
+
return r[k] if isinstance(r, Mapping) else getattr(r, k)
|
|
326
|
+
|
|
327
|
+
# %% ../nbs/00_core.ipynb #8e6ca8d9
|
|
328
|
+
@patch
|
|
329
|
+
async def pks_and_rows_where(self:Table, **kwargs):
|
|
330
|
+
"Like rows_where but returns (pk, row) tuples"
|
|
331
|
+
rows = await self.rows_where(**kwargs)
|
|
332
|
+
pk = self.pks[0] if self.pks else None
|
|
333
|
+
return [(get_field(r, pk) if pk else None, r) for r in rows]
|
|
334
|
+
|
|
335
|
+
# %% ../nbs/00_core.ipynb #0774d383
|
|
336
|
+
@patch
|
|
337
|
+
async def __call__(self:Table, where=None, where_args=None, order_by=None, limit=None, offset=None, select='*', with_pk=False,
|
|
338
|
+
as_cls=True, debug=False):
|
|
339
|
+
"Query table rows"
|
|
340
|
+
f = self.pks_and_rows_where if with_pk else self.rows_where
|
|
341
|
+
return await f(where=where, where_args=where_args, order_by=order_by, limit=limit, offset=offset, select=select,
|
|
342
|
+
as_cls=as_cls, debug=debug)
|
|
343
|
+
|
|
344
|
+
# %% ../nbs/00_core.ipynb #73e88814
|
|
345
|
+
@patch
|
|
346
|
+
async def selectone(
|
|
347
|
+
self:Table,
|
|
348
|
+
where:str|None=None, # SQL where fragment to use, for example `id > ?`
|
|
349
|
+
where_args: Iterable|dict|NoneType=None, # Parameters to use with `where`; iterable for `id>?`, or dict for `id>:id`
|
|
350
|
+
select:str = "*", # Comma-separated list of columns to select
|
|
351
|
+
as_cls:bool=True, # Convert returned dict to stored dataclass?
|
|
352
|
+
debug:bool=False
|
|
353
|
+
)->list:
|
|
354
|
+
"Shortcut for `__call__` that returns exactly one item"
|
|
355
|
+
res = await self(where=where, where_args=where_args, select=select, as_cls=as_cls, limit=2, debug=debug)
|
|
356
|
+
if len(res)==0: raise NotFoundError
|
|
357
|
+
elif len(res) > 1: raise ValueError(f"Not unique: {len(res)} results")
|
|
358
|
+
return res[0]
|
|
359
|
+
|
|
360
|
+
# %% ../nbs/00_core.ipynb #215c7630
|
|
361
|
+
@patch
|
|
362
|
+
async def item(self:Database, sql, args=None):
|
|
363
|
+
"Execute sql and return a single field from a single row"
|
|
364
|
+
res = await self.fetch(sql, *(args or []))
|
|
365
|
+
if len(res)==0: raise NotFoundError
|
|
366
|
+
elif len(res) > 1: raise ValueError(f"Not unique: {len(res)} results")
|
|
367
|
+
row = res[0]
|
|
368
|
+
if len(row) > 1: raise ValueError(f"Too many fields: {len(row)} fields")
|
|
369
|
+
return row[0]
|
|
370
|
+
|
|
371
|
+
# %% ../nbs/00_core.ipynb #0261da8a
|
|
372
|
+
def create_mod(db, mod_fn, with_views=False, store=True, suf=''):
|
|
373
|
+
"Create module for dataclasses for `db`"
|
|
374
|
+
mod_fn = str(mod_fn)
|
|
375
|
+
if not mod_fn.endswith('.py'): mod_fn+='.py'
|
|
376
|
+
dcs = all_dcs(db, with_views, store=store, suf=suf)
|
|
377
|
+
strlist = ', '.join([f'"{o.__name__}"' for o in dcs])
|
|
378
|
+
with open(mod_fn, 'w') as f:
|
|
379
|
+
print(f'__all__ = [{strlist}]', file=f)
|
|
380
|
+
print('from dataclasses import dataclass', file=f)
|
|
381
|
+
print('import datetime,decimal', file=f)
|
|
382
|
+
print('from uuid import UUID', file=f)
|
|
383
|
+
print('from fastcore.utils import UNSET', file=f)
|
|
384
|
+
for o in dcs: print(dataclass_src(o), file=f)
|
|
385
|
+
|
|
386
|
+
# %% ../nbs/00_core.ipynb #2002bcaf
|
|
387
|
+
@patch
|
|
388
|
+
def link_dcs(self:Database, mod):
|
|
389
|
+
"Set the internal dataclass type links for tables using `mod` (created via `create_mod`)"
|
|
390
|
+
for o in mod.__all__: self.t[o.lower()].cls = getattr(mod, o)
|
|
391
|
+
|
|
392
|
+
# %% ../nbs/00_core.ipynb #8de706b8
|
|
393
|
+
@patch
|
|
394
|
+
def set_classes(self:Database, glb):
|
|
395
|
+
"Add set all table dataclasses using types in namespace `glb`"
|
|
396
|
+
for tbl in self.t: tbl.cls = glb[tbl.name.title()]
|
|
397
|
+
|
|
398
|
+
# %% ../nbs/00_core.ipynb #a25449f1
|
|
399
|
+
@patch
|
|
400
|
+
def get_tables(self:Database, glb):
|
|
401
|
+
"Add objects for all table objects to namespace `glb`"
|
|
402
|
+
for tbl in self.t: glb[tbl.name.lower()+'s'] = tbl
|
|
403
|
+
|
|
404
|
+
# %% ../nbs/00_core.ipynb #82a57623
|
|
405
|
+
from dataclasses import asdict
|
|
406
|
+
from enum import Enum
|
|
407
|
+
|
|
408
|
+
# %% ../nbs/00_core.ipynb #b405dc99
|
|
409
|
+
def _process_row(row, kwargs):
|
|
410
|
+
if row is None: d = {}
|
|
411
|
+
elif not is_dataclass(row): d = dict(row) if hasattr(row, 'items') else {}
|
|
412
|
+
else: d = {k:(v.value if isinstance(v, Enum) else v) for k,v in asdict(row).items() if v is not UNSET}
|
|
413
|
+
return d|kwargs
|
|
414
|
+
|
|
415
|
+
# %% ../nbs/00_core.ipynb #343a8cc8
|
|
416
|
+
def _prep_row(record, kwargs):
|
|
417
|
+
row = _process_row(record, kwargs)
|
|
418
|
+
if not row: return None*3
|
|
419
|
+
cols = ', '.join(f'"{k}"' for k in row)
|
|
420
|
+
vals = ', '.join(f'${i+1}' for i in range(len(row)))
|
|
421
|
+
return row, cols, vals
|
|
422
|
+
|
|
423
|
+
@patch
|
|
424
|
+
async def insert(self:Table, record=None, **kwargs):
|
|
425
|
+
"Insert a row and return it"
|
|
426
|
+
row, cols, vals = _prep_row(record, {**kwargs, **self.xtra_id})
|
|
427
|
+
if not row: return None
|
|
428
|
+
sql = f'INSERT INTO {self} ({cols}) VALUES ({vals}) RETURNING *'
|
|
429
|
+
return await self._rec(sql, *row.values())
|
|
430
|
+
|
|
431
|
+
# %% ../nbs/00_core.ipynb #8a782068
|
|
432
|
+
@patch
|
|
433
|
+
async def _retr_tbl(self:Database, name):
|
|
434
|
+
await self.refresh()
|
|
435
|
+
return self.t[name]
|
|
436
|
+
|
|
437
|
+
# %% ../nbs/00_core.ipynb #8e5e35ab
|
|
438
|
+
import inspect
|
|
439
|
+
|
|
440
|
+
# %% ../nbs/00_core.ipynb #e9c78b87
|
|
441
|
+
@patch
|
|
442
|
+
async def table2glb(self:Database, name, glb=None):
|
|
443
|
+
"Get table by name, refreshing metadata and creating dataclass, adding to glb"
|
|
444
|
+
if glb is None: glb = inspect.currentframe().f_back.f_globals
|
|
445
|
+
tbl = await self._retr_tbl(name)
|
|
446
|
+
cls = tbl.dataclass()
|
|
447
|
+
glb[name+'s'],glb[cls.__name__] = tbl,cls
|
|
448
|
+
|
|
449
|
+
# %% ../nbs/00_core.ipynb #9b261543
|
|
450
|
+
def _pk_where(pks, offset=0):
|
|
451
|
+
return ' AND '.join(f'"{pk}"=${i+offset+1}' for i,pk in enumerate(pks))
|
|
452
|
+
|
|
453
|
+
# %% ../nbs/00_core.ipynb #51f2edca
|
|
454
|
+
@patch
|
|
455
|
+
async def update(self:Table, record=None, pk_values=None, **kwargs):
|
|
456
|
+
"Update a row and return it"
|
|
457
|
+
row = _process_row(record, kwargs)
|
|
458
|
+
if not row: return None
|
|
459
|
+
if pk_values is None: pk_values = [row[o] for o in self.pks]
|
|
460
|
+
sets = ', '.join(f'"{k}"=${i+1}' for i,k in enumerate(row))
|
|
461
|
+
xwhere = _pk_where(self.pks, len(row))
|
|
462
|
+
pk_where, args = _add_xtra(self, xwhere, pk_values, len(row))
|
|
463
|
+
sql = f'UPDATE {self} SET {sets} WHERE {pk_where} RETURNING *'
|
|
464
|
+
return await self._rec(sql, *row.values(), *args, err=f"{self.name}[{pk_values}]")
|
|
465
|
+
|
|
466
|
+
# %% ../nbs/00_core.ipynb #f9968e6f
|
|
467
|
+
@patch
|
|
468
|
+
async def delete(self:Table, pk_values):
|
|
469
|
+
"Delete row by primary key, returning the deleted row"
|
|
470
|
+
pk_where, args = _add_xtra(self, _pk_where(self.pks), listify(pk_values))
|
|
471
|
+
sql = f'DELETE FROM {self} WHERE {pk_where} RETURNING *'
|
|
472
|
+
return await self._rec(sql, *args, err=f"{self.name}[{pk_values}]")
|
|
473
|
+
|
|
474
|
+
# %% ../nbs/00_core.ipynb #0fc57f94
|
|
475
|
+
@patch
|
|
476
|
+
async def delete_where(self:Table, where=None, where_args=None):
|
|
477
|
+
where, args = _add_xtra(self, where, where_args or [])
|
|
478
|
+
sql = f'DELETE FROM {self}' + (f' WHERE {where}' if where else '') + ' RETURNING *'
|
|
479
|
+
return await self._recs(sql, *args)
|
|
480
|
+
|
|
481
|
+
# %% ../nbs/00_core.ipynb #d45f513e
|
|
482
|
+
py_to_pg = {v: k for k, v in pg_to_py.items() if v not in (list, tuple, Range)}
|
|
483
|
+
# Override some for cleaner defaults
|
|
484
|
+
py_to_pg.update({int: 'INTEGER', str: 'TEXT', float: 'REAL', bool: 'BOOLEAN'})
|
|
485
|
+
|
|
486
|
+
# %% ../nbs/00_core.ipynb #21e6d1a5
|
|
487
|
+
def col_def(name, typ, pk, not_null):
|
|
488
|
+
"Build column definition SQL for CREATE TABLE"
|
|
489
|
+
pg_typ = py_to_pg.get(typ, 'TEXT')
|
|
490
|
+
if name == pk and typ == int: pg_typ = 'SERIAL'
|
|
491
|
+
parts = [f'"{name}"', pg_typ]
|
|
492
|
+
if name == pk: parts.append('PRIMARY KEY')
|
|
493
|
+
elif not_null and name in not_null: parts.append('NOT NULL')
|
|
494
|
+
return ' '.join(parts)
|
|
495
|
+
|
|
496
|
+
# %% ../nbs/00_core.ipynb #2c17673d
|
|
497
|
+
@patch
|
|
498
|
+
async def create(self:Database, cls=None, name=None, pk='id', foreign_keys=None, defaults=None,
|
|
499
|
+
column_order=None, not_null=None, if_not_exists=False, replace=False):
|
|
500
|
+
"Create table from `cls`"
|
|
501
|
+
flexiclass(cls)
|
|
502
|
+
if name is None: name = camel2snake(cls.__name__)
|
|
503
|
+
typs = {o.name: o.type for o in fields(cls)}
|
|
504
|
+
if column_order: typs = {k: typs[k] for k in column_order if k in typs}
|
|
505
|
+
|
|
506
|
+
cols = [col_def(k, v, pk, not_null) for k, v in typs.items()]
|
|
507
|
+
if defaults:
|
|
508
|
+
for i, (k, v) in enumerate(typs.items()):
|
|
509
|
+
if k in defaults: cols[i] += f' DEFAULT {defaults[k]!r}'
|
|
510
|
+
if foreign_keys:
|
|
511
|
+
for col, (ref_tbl, ref_col) in foreign_keys.items():
|
|
512
|
+
cols.append(f'FOREIGN KEY ("{col}") REFERENCES "{ref_tbl}" ("{ref_col}")')
|
|
513
|
+
|
|
514
|
+
col_sql = ', '.join(cols)
|
|
515
|
+
exists = 'IF NOT EXISTS ' if if_not_exists else ''
|
|
516
|
+
if replace: await self.execute(f'DROP TABLE IF EXISTS "{name}" CASCADE')
|
|
517
|
+
await self.execute(f'CREATE TABLE {exists}"{name}" ( {col_sql} )')
|
|
518
|
+
tbl = await self._retr_tbl(name)
|
|
519
|
+
tbl.cls = cls
|
|
520
|
+
return tbl
|
|
521
|
+
|
|
522
|
+
# %% ../nbs/00_core.ipynb #de113b34
|
|
523
|
+
@patch
|
|
524
|
+
async def drop(self:Table, cascade=False):
|
|
525
|
+
"Drop this table"
|
|
526
|
+
casc = ' CASCADE' if cascade else ''
|
|
527
|
+
await self.db.execute(f'DROP TABLE IF EXISTS {self}{casc}')
|
|
528
|
+
await self.db.refresh()
|
|
529
|
+
|
|
530
|
+
# %% ../nbs/00_core.ipynb #c5b5bd8f
|
|
531
|
+
@patch
|
|
532
|
+
async def upsert(self:Table, record=None, **kwargs):
|
|
533
|
+
"Insert or update a row and return it"
|
|
534
|
+
row, cols, vals = _prep_row(record, {**kwargs, **self.xtra_id})
|
|
535
|
+
if not row: return None
|
|
536
|
+
pk = self.pks[0]
|
|
537
|
+
updates = ', '.join(f'"{k}"=EXCLUDED."{k}"' for k in row if k != pk)
|
|
538
|
+
return await self._rec(f'INSERT INTO {self} ({cols}) VALUES ({vals}) ON CONFLICT ("{pk}") DO UPDATE SET {updates} RETURNING *', *row.values())
|
|
539
|
+
|
|
540
|
+
# %% ../nbs/00_core.ipynb #6be00990
|
|
541
|
+
async def create_pool(*args, **kwargs):
|
|
542
|
+
kwargs.setdefault('record_class', FRecord)
|
|
543
|
+
kwargs.setdefault('init', setup_json)
|
|
544
|
+
pool = await asyncpg.create_pool(*args, **kwargs)
|
|
545
|
+
res = Database(pool, refresh=False)
|
|
546
|
+
await res.refresh()
|
|
547
|
+
return res
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastasyncpg
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A simple wrapper for asyncpg
|
|
5
|
+
Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Repository, https://github.com/AnswerDotAI/fastasyncpg
|
|
8
|
+
Project-URL: Documentation, https://AnswerDotAI.github.io/fastasyncpg/
|
|
9
|
+
Keywords: nbdev
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: asyncpg
|
|
16
|
+
Requires-Dist: fastcore
|
|
17
|
+
Requires-Dist: sqlparse
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# fastasyncpg
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
24
|
+
|
|
25
|
+
This file will become your README and also the index of your
|
|
26
|
+
documentation.
|
|
27
|
+
|
|
28
|
+
## Developer Guide
|
|
29
|
+
|
|
30
|
+
If you are new to using `nbdev` here are some useful pointers to get you
|
|
31
|
+
started.
|
|
32
|
+
|
|
33
|
+
### Install fastasyncpg in Development mode
|
|
34
|
+
|
|
35
|
+
``` sh
|
|
36
|
+
# make sure fastasyncpg package is installed in development mode
|
|
37
|
+
$ pip install -e .
|
|
38
|
+
|
|
39
|
+
# make changes under nbs/ directory
|
|
40
|
+
# ...
|
|
41
|
+
|
|
42
|
+
# compile to have changes apply to fastasyncpg
|
|
43
|
+
$ nbdev_prepare
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
### Installation
|
|
49
|
+
|
|
50
|
+
Install latest from the GitHub
|
|
51
|
+
[repository](https://github.com/AnswerDotAI/fastasyncpg):
|
|
52
|
+
|
|
53
|
+
``` sh
|
|
54
|
+
$ pip install git+https://github.com/AnswerDotAI/fastasyncpg.git
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
or from [conda](https://anaconda.org/AnswerDotAI/fastasyncpg)
|
|
58
|
+
|
|
59
|
+
``` sh
|
|
60
|
+
$ conda install -c AnswerDotAI fastasyncpg
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
or from [pypi](https://pypi.org/project/fastasyncpg/)
|
|
64
|
+
|
|
65
|
+
``` sh
|
|
66
|
+
$ pip install fastasyncpg
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Documentation
|
|
70
|
+
|
|
71
|
+
Documentation can be found hosted on this GitHub
|
|
72
|
+
[repository](https://github.com/AnswerDotAI/fastasyncpg)’s
|
|
73
|
+
[pages](https://AnswerDotAI.github.io/fastasyncpg/). Additionally you
|
|
74
|
+
can find package manager specific guidelines on
|
|
75
|
+
[conda](https://anaconda.org/AnswerDotAI/fastasyncpg) and
|
|
76
|
+
[pypi](https://pypi.org/project/fastasyncpg/) respectively.
|
|
77
|
+
|
|
78
|
+
## How to use
|
|
79
|
+
|
|
80
|
+
Fill me in please! Don’t forget code examples:
|
|
81
|
+
|
|
82
|
+
``` python
|
|
83
|
+
1+1
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
2
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
fastasyncpg/__init__.py
|
|
6
|
+
fastasyncpg/_modidx.py
|
|
7
|
+
fastasyncpg/core.py
|
|
8
|
+
fastasyncpg.egg-info/PKG-INFO
|
|
9
|
+
fastasyncpg.egg-info/SOURCES.txt
|
|
10
|
+
fastasyncpg.egg-info/dependency_links.txt
|
|
11
|
+
fastasyncpg.egg-info/entry_points.txt
|
|
12
|
+
fastasyncpg.egg-info/requires.txt
|
|
13
|
+
fastasyncpg.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fastasyncpg
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "fastasyncpg"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "A simple wrapper for asyncpg"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "Apache-2.0"}
|
|
12
|
+
authors = [{name = "Jeremy Howard", email = "github@jhoward.fastmail.fm"}]
|
|
13
|
+
keywords = ['nbdev']
|
|
14
|
+
classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only" ]
|
|
15
|
+
dependencies = [ "asyncpg", "fastcore","sqlparse" ]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Repository = "https://github.com/AnswerDotAI/fastasyncpg"
|
|
19
|
+
Documentation = "https://AnswerDotAI.github.io/fastasyncpg/"
|
|
20
|
+
|
|
21
|
+
[project.entry-points.nbdev]
|
|
22
|
+
fastasyncpg = "fastasyncpg._modidx:d"
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.dynamic]
|
|
25
|
+
version = {attr = "fastasyncpg.__version__"}
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
28
|
+
include = ["fastasyncpg"]
|
|
29
|
+
|
|
30
|
+
[tool.nbdev]
|
|
31
|
+
custom_sidebar = false
|