yhttp-dbmanager 2.8.0__tar.gz → 3.0.0__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.
- {yhttp_dbmanager-2.8.0/yhttp_dbmanager.egg-info → yhttp_dbmanager-3.0.0}/PKG-INFO +9 -4
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/README.md +8 -2
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/setup.py +2 -2
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/tests/test_dburi.py +17 -4
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp/ext/dbmanager/__init__.py +2 -2
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp/ext/dbmanager/cli.py +4 -4
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp/ext/dbmanager/dbmanager.py +3 -2
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp/ext/dbmanager/install.py +3 -3
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp/ext/dbmanager/uri.py +16 -7
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0/yhttp_dbmanager.egg-info}/PKG-INFO +9 -4
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp_dbmanager.egg-info/requires.txt +0 -1
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/LICENSE +0 -0
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/setup.cfg +0 -0
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/tests/test_cli.py +0 -0
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/tests/test_dbmanager.py +0 -0
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/tests/test_install.py +0 -0
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp_dbmanager.egg-info/SOURCES.txt +0 -0
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp_dbmanager.egg-info/dependency_links.txt +0 -0
- {yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp_dbmanager.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: yhttp-dbmanager
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Database manager command line interface and API for yhttp.
|
|
5
5
|
Home-page: http://github.com/yhttp/yhttp-dbmanager
|
|
6
6
|
Author: Vahid Mardani
|
|
@@ -23,7 +23,6 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
25
|
Requires-Dist: yhttp<5,>=3.5.2
|
|
26
|
-
Requires-Dist: dbmanager
|
|
27
26
|
Requires-Dist: psycopg2
|
|
28
27
|
|
|
29
28
|
# yhttp-dbmanager
|
|
@@ -34,7 +33,7 @@ API.
|
|
|
34
33
|
## Contribution
|
|
35
34
|
|
|
36
35
|
### Dependencies
|
|
37
|
-
Install `
|
|
36
|
+
Install `postgresql` brefore use of this project.
|
|
38
37
|
```bash
|
|
39
38
|
apt install postgresql
|
|
40
39
|
```
|
|
@@ -93,6 +92,12 @@ make cover-html
|
|
|
93
92
|
```
|
|
94
93
|
|
|
95
94
|
|
|
95
|
+
# Lint
|
|
96
|
+
```bash
|
|
97
|
+
make lint
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
|
|
96
101
|
### Distribution
|
|
97
102
|
Execute these commands to create `Python`'s standard distribution packages
|
|
98
103
|
at `dist` directory:
|
|
@@ -113,7 +118,7 @@ Execute:
|
|
|
113
118
|
```bash
|
|
114
119
|
make clean
|
|
115
120
|
```
|
|
116
|
-
to clean-up previous dist
|
|
121
|
+
to clean-up previous `dist/*` and `build/*` directories.
|
|
117
122
|
|
|
118
123
|
|
|
119
124
|
### PyPI
|
|
@@ -6,7 +6,7 @@ API.
|
|
|
6
6
|
## Contribution
|
|
7
7
|
|
|
8
8
|
### Dependencies
|
|
9
|
-
Install `
|
|
9
|
+
Install `postgresql` brefore use of this project.
|
|
10
10
|
```bash
|
|
11
11
|
apt install postgresql
|
|
12
12
|
```
|
|
@@ -65,6 +65,12 @@ make cover-html
|
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
# Lint
|
|
69
|
+
```bash
|
|
70
|
+
make lint
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
|
|
68
74
|
### Distribution
|
|
69
75
|
Execute these commands to create `Python`'s standard distribution packages
|
|
70
76
|
at `dist` directory:
|
|
@@ -85,7 +91,7 @@ Execute:
|
|
|
85
91
|
```bash
|
|
86
92
|
make clean
|
|
87
93
|
```
|
|
88
|
-
to clean-up previous dist
|
|
94
|
+
to clean-up previous `dist/*` and `build/*` directories.
|
|
89
95
|
|
|
90
96
|
|
|
91
97
|
### PyPI
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
from setuptools import setup
|
|
2
1
|
import os.path
|
|
3
2
|
import re
|
|
4
3
|
|
|
4
|
+
from setuptools import setup
|
|
5
|
+
|
|
5
6
|
|
|
6
7
|
# reading package's version (same way sqlalchemy does)
|
|
7
8
|
with open(
|
|
@@ -18,7 +19,6 @@ with open(
|
|
|
18
19
|
|
|
19
20
|
dependencies = [
|
|
20
21
|
'yhttp >= 3.5.2, < 5',
|
|
21
|
-
'dbmanager',
|
|
22
22
|
'psycopg2',
|
|
23
23
|
]
|
|
24
24
|
|
|
@@ -11,7 +11,7 @@ def test_dburi():
|
|
|
11
11
|
assert uri.user == 'bar'
|
|
12
12
|
assert uri.password == 'baz'
|
|
13
13
|
assert uri.host == 'qux'
|
|
14
|
-
assert uri.
|
|
14
|
+
assert uri.database == 'quux.thud'
|
|
15
15
|
assert uri.dumps() == uristr
|
|
16
16
|
|
|
17
17
|
# Invalid uri
|
|
@@ -26,7 +26,7 @@ def test_dburi():
|
|
|
26
26
|
assert uri.user == 'bar'
|
|
27
27
|
assert uri.password == ''
|
|
28
28
|
assert uri.host == 'qux'
|
|
29
|
-
assert uri.
|
|
29
|
+
assert uri.database == 'quux.thud'
|
|
30
30
|
assert uri.dumps() == uristr
|
|
31
31
|
|
|
32
32
|
# Without username and password
|
|
@@ -36,7 +36,7 @@ def test_dburi():
|
|
|
36
36
|
assert uri.user == ''
|
|
37
37
|
assert uri.password == ''
|
|
38
38
|
assert uri.host == 'qux'
|
|
39
|
-
assert uri.
|
|
39
|
+
assert uri.database == 'quux.thud'
|
|
40
40
|
assert uri.dumps() == uristr
|
|
41
41
|
|
|
42
42
|
# Without username, password and host
|
|
@@ -46,5 +46,18 @@ def test_dburi():
|
|
|
46
46
|
assert uri.user == ''
|
|
47
47
|
assert uri.password == ''
|
|
48
48
|
assert uri.host == ''
|
|
49
|
-
assert uri.
|
|
49
|
+
assert uri.database == 'quux.thud'
|
|
50
50
|
assert uri.dumps() == uristr
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_dburi_todict():
|
|
54
|
+
uristr = 'foo://bar:baz@qux/quux.thud'
|
|
55
|
+
uri = DatabaseURI.loads(uristr)
|
|
56
|
+
|
|
57
|
+
assert uri.todict() == dict(
|
|
58
|
+
provider='foo',
|
|
59
|
+
user='bar',
|
|
60
|
+
password='baz',
|
|
61
|
+
host='qux',
|
|
62
|
+
database='quux.thud'
|
|
63
|
+
)
|
|
@@ -50,7 +50,7 @@ class DatabaseAdministrativeCommand(SubCommand):
|
|
|
50
50
|
user=args.user,
|
|
51
51
|
password=password,
|
|
52
52
|
host=args.host,
|
|
53
|
-
|
|
53
|
+
database=args.database
|
|
54
54
|
)
|
|
55
55
|
|
|
56
56
|
def getappdbinfo(self, args):
|
|
@@ -65,7 +65,7 @@ class CreateDatabase(DatabaseAdministrativeCommand):
|
|
|
65
65
|
|
|
66
66
|
def __call__(self, args):
|
|
67
67
|
uri = self.getappdbinfo(args)
|
|
68
|
-
self.getdbmanager(args).create(uri.
|
|
68
|
+
self.getdbmanager(args).create(uri.database, owner=uri.user)
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
class DropDatabase(DatabaseAdministrativeCommand):
|
|
@@ -74,10 +74,10 @@ class DropDatabase(DatabaseAdministrativeCommand):
|
|
|
74
74
|
|
|
75
75
|
def __call__(self, args):
|
|
76
76
|
uri = self.getappdbinfo(args)
|
|
77
|
-
self.getdbmanager(args).drop(uri.
|
|
77
|
+
self.getdbmanager(args).drop(uri.database)
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
class
|
|
80
|
+
class DatabaseCommand(SubCommand):
|
|
81
81
|
__command__ = 'database'
|
|
82
82
|
__aliases__ = ['db']
|
|
83
83
|
__arguments__ = [
|
|
@@ -29,10 +29,11 @@ class DatabaseManager(metaclass=abc.ABCMeta):
|
|
|
29
29
|
|
|
30
30
|
class PostgresqlManager(DatabaseManager):
|
|
31
31
|
|
|
32
|
-
def __init__(self, host=None,
|
|
32
|
+
def __init__(self, host=None, database='postgres', user=None,
|
|
33
|
+
password=None):
|
|
33
34
|
self.connection = psycopg2.connect(
|
|
34
35
|
host=host,
|
|
35
|
-
dbname=
|
|
36
|
+
dbname=database,
|
|
36
37
|
user=user,
|
|
37
38
|
password=password
|
|
38
39
|
)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from .cli import
|
|
1
|
+
from .cli import DatabaseCommand
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
def install(app, cliarguments=None):
|
|
5
|
-
app.cliarguments.append(
|
|
5
|
+
app.cliarguments.append(DatabaseCommand)
|
|
6
6
|
if cliarguments:
|
|
7
|
-
|
|
7
|
+
DatabaseCommand.__arguments__.extend(cliarguments)
|
|
8
8
|
|
|
9
9
|
@app.when
|
|
10
10
|
def ready(app):
|
|
@@ -3,24 +3,24 @@ import re
|
|
|
3
3
|
|
|
4
4
|
URIPATTERN = re.compile(
|
|
5
5
|
r'(?P<provider>.*)://(?P<user>.*):(?P<password>.*)@(?P<host>.*)/'
|
|
6
|
-
r'(?P<
|
|
6
|
+
r'(?P<database>.*)'
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class DatabaseURI:
|
|
11
|
-
def __init__(self, provider,
|
|
11
|
+
def __init__(self, provider, database, host='', user='', password=''):
|
|
12
12
|
assert provider
|
|
13
|
-
assert
|
|
13
|
+
assert database
|
|
14
14
|
|
|
15
15
|
self.provider = provider
|
|
16
16
|
self.host = host
|
|
17
|
-
self.
|
|
17
|
+
self.database = database
|
|
18
18
|
self.user = user
|
|
19
19
|
self.password = password
|
|
20
20
|
|
|
21
21
|
def dumps(self):
|
|
22
22
|
return f'{self.provider}://{self.user}:{self.password}@{self.host}' \
|
|
23
|
-
f'/{self.
|
|
23
|
+
f'/{self.database}'
|
|
24
24
|
|
|
25
25
|
@classmethod
|
|
26
26
|
def loads(cls, uri):
|
|
@@ -31,11 +31,20 @@ class DatabaseURI:
|
|
|
31
31
|
u = match.groupdict()
|
|
32
32
|
|
|
33
33
|
assert u.get('provider')
|
|
34
|
-
assert u.get('
|
|
34
|
+
assert u.get('database')
|
|
35
35
|
return cls(
|
|
36
36
|
u.get('provider'),
|
|
37
|
-
u.get('
|
|
37
|
+
u.get('database'),
|
|
38
38
|
u.get('host'),
|
|
39
39
|
u.get('user'),
|
|
40
40
|
u.get('password'),
|
|
41
41
|
)
|
|
42
|
+
|
|
43
|
+
def todict(self):
|
|
44
|
+
return dict(
|
|
45
|
+
provider=self.provider,
|
|
46
|
+
user=self.user,
|
|
47
|
+
password=self.password,
|
|
48
|
+
host=self.host,
|
|
49
|
+
database=self.database
|
|
50
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: yhttp-dbmanager
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Database manager command line interface and API for yhttp.
|
|
5
5
|
Home-page: http://github.com/yhttp/yhttp-dbmanager
|
|
6
6
|
Author: Vahid Mardani
|
|
@@ -23,7 +23,6 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
25
|
Requires-Dist: yhttp<5,>=3.5.2
|
|
26
|
-
Requires-Dist: dbmanager
|
|
27
26
|
Requires-Dist: psycopg2
|
|
28
27
|
|
|
29
28
|
# yhttp-dbmanager
|
|
@@ -34,7 +33,7 @@ API.
|
|
|
34
33
|
## Contribution
|
|
35
34
|
|
|
36
35
|
### Dependencies
|
|
37
|
-
Install `
|
|
36
|
+
Install `postgresql` brefore use of this project.
|
|
38
37
|
```bash
|
|
39
38
|
apt install postgresql
|
|
40
39
|
```
|
|
@@ -93,6 +92,12 @@ make cover-html
|
|
|
93
92
|
```
|
|
94
93
|
|
|
95
94
|
|
|
95
|
+
# Lint
|
|
96
|
+
```bash
|
|
97
|
+
make lint
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
|
|
96
101
|
### Distribution
|
|
97
102
|
Execute these commands to create `Python`'s standard distribution packages
|
|
98
103
|
at `dist` directory:
|
|
@@ -113,7 +118,7 @@ Execute:
|
|
|
113
118
|
```bash
|
|
114
119
|
make clean
|
|
115
120
|
```
|
|
116
|
-
to clean-up previous dist
|
|
121
|
+
to clean-up previous `dist/*` and `build/*` directories.
|
|
117
122
|
|
|
118
123
|
|
|
119
124
|
### PyPI
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{yhttp_dbmanager-2.8.0 → yhttp_dbmanager-3.0.0}/yhttp_dbmanager.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|