postgresdb3 0.2.0__tar.gz → 0.2.2__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.
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/PKG-INFO +63 -4
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/README.md +62 -3
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/postgresdb3.egg-info/PKG-INFO +63 -4
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/setup.py +1 -1
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/postgresdb3/__init__.py +0 -0
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/postgresdb3/async_db.py +0 -0
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/postgresdb3/sync_db.py +0 -0
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/postgresdb3.egg-info/SOURCES.txt +0 -0
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/postgresdb3.egg-info/dependency_links.txt +0 -0
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/postgresdb3.egg-info/requires.txt +0 -0
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/postgresdb3.egg-info/top_level.txt +0 -0
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/pyproject.toml +0 -0
- {postgresdb3-0.2.0 → postgresdb3-0.2.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: postgresdb3
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Python uchun oddiy PostgreSQL wrapper
|
|
5
5
|
Home-page: https://github.com/AlijonovUz/PostgresDB
|
|
6
6
|
Author: Abdulbosit Alijonov
|
|
@@ -22,6 +22,10 @@ Dynamic: summary
|
|
|
22
22
|
|
|
23
23
|
# PostgresDB
|
|
24
24
|
|
|
25
|
+

|
|
26
|
+

|
|
27
|
+

|
|
28
|
+
|
|
25
29
|
Oddiy va qulay Python wrapper PostgreSQL bazasi bilan ishlash uchun.
|
|
26
30
|
|
|
27
31
|
## O'rnatish
|
|
@@ -30,7 +34,7 @@ Oddiy va qulay Python wrapper PostgreSQL bazasi bilan ishlash uchun.
|
|
|
30
34
|
pip install postgresdb3
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
## Foydalanish
|
|
37
|
+
## Foydalanish (Sync)
|
|
34
38
|
|
|
35
39
|
``` python
|
|
36
40
|
from postgresdb3 import PostgresDB
|
|
@@ -40,8 +44,8 @@ db = PostgresDB(
|
|
|
40
44
|
database="mydb",
|
|
41
45
|
user="postgres",
|
|
42
46
|
password="mypassword",
|
|
43
|
-
host="localhost",
|
|
44
|
-
port=5432
|
|
47
|
+
host="localhost", # ixtiyoriy
|
|
48
|
+
port=5432 # ixtiyoriy
|
|
45
49
|
)
|
|
46
50
|
|
|
47
51
|
# Jadval yaratish
|
|
@@ -76,6 +80,61 @@ db.delete("users", "name", "Ali")
|
|
|
76
80
|
db.drop("users")
|
|
77
81
|
```
|
|
78
82
|
|
|
83
|
+
## Foydalanish (Async)
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import asyncio
|
|
87
|
+
from postgresdb3 import AsyncPostgresDB
|
|
88
|
+
|
|
89
|
+
async def main():
|
|
90
|
+
# Bazaga ulanish
|
|
91
|
+
db = AsyncPostgresDB(
|
|
92
|
+
database="mydb",
|
|
93
|
+
user="postgres",
|
|
94
|
+
password="mypassword",
|
|
95
|
+
host="localhost", # ixtiyoriy
|
|
96
|
+
port=5432 # ixtiyoriy
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
# Jadval yaratish
|
|
100
|
+
await db.create("users", "id SERIAL PRIMARY KEY, name VARCHAR(100), age INT")
|
|
101
|
+
|
|
102
|
+
# Ma'lumot qo'shish
|
|
103
|
+
await db.insert("users", "name, age", ["Ali", 25])
|
|
104
|
+
await db.insert("users", "name, age", ["Vali", 30])
|
|
105
|
+
|
|
106
|
+
# Barcha ma'lumotlarni olish
|
|
107
|
+
users = await db.select("users")
|
|
108
|
+
print("Barcha foydalanuvchilar:", users)
|
|
109
|
+
|
|
110
|
+
# Bitta qatorni olish
|
|
111
|
+
user = await db.select("users", where=("name=$1", ["Ali"]), fetchone=True)
|
|
112
|
+
print("Foydalanuvchi Ali:", user)
|
|
113
|
+
|
|
114
|
+
# Shart bilan ma'lumot olish
|
|
115
|
+
adults = await db.select("users", where=("age > $1", [18]))
|
|
116
|
+
print("Kattalar:", adults)
|
|
117
|
+
|
|
118
|
+
# Bir nechta shart
|
|
119
|
+
specific_users = await db.select("users", where=("age > $1 AND name = $2", [18, "Ali"]))
|
|
120
|
+
print("Maxsus foydalanuvchi:", specific_users)
|
|
121
|
+
|
|
122
|
+
# Jadvaldagi ma'lumotni yangilash
|
|
123
|
+
await db.update("users", "age", 26, "name", "Ali")
|
|
124
|
+
|
|
125
|
+
# Ma'lumotni o'chirish
|
|
126
|
+
await db.delete("users", "name", "Ali")
|
|
127
|
+
|
|
128
|
+
# Jadvalni o'chirish
|
|
129
|
+
await db.drop("users")
|
|
130
|
+
|
|
131
|
+
# Connection poolni yopish
|
|
132
|
+
await db.close_pool()
|
|
133
|
+
|
|
134
|
+
# Asinxron loop ishga tushirish
|
|
135
|
+
asyncio.run(main())
|
|
136
|
+
```
|
|
137
|
+
|
|
79
138
|
## Parametrlar va metodlar
|
|
80
139
|
|
|
81
140
|
**PostgresDB(database, user, password, host="localhost", port=5432)**
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# PostgresDB
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
3
7
|
Oddiy va qulay Python wrapper PostgreSQL bazasi bilan ishlash uchun.
|
|
4
8
|
|
|
5
9
|
## O'rnatish
|
|
@@ -8,7 +12,7 @@ Oddiy va qulay Python wrapper PostgreSQL bazasi bilan ishlash uchun.
|
|
|
8
12
|
pip install postgresdb3
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
## Foydalanish
|
|
15
|
+
## Foydalanish (Sync)
|
|
12
16
|
|
|
13
17
|
``` python
|
|
14
18
|
from postgresdb3 import PostgresDB
|
|
@@ -18,8 +22,8 @@ db = PostgresDB(
|
|
|
18
22
|
database="mydb",
|
|
19
23
|
user="postgres",
|
|
20
24
|
password="mypassword",
|
|
21
|
-
host="localhost",
|
|
22
|
-
port=5432
|
|
25
|
+
host="localhost", # ixtiyoriy
|
|
26
|
+
port=5432 # ixtiyoriy
|
|
23
27
|
)
|
|
24
28
|
|
|
25
29
|
# Jadval yaratish
|
|
@@ -54,6 +58,61 @@ db.delete("users", "name", "Ali")
|
|
|
54
58
|
db.drop("users")
|
|
55
59
|
```
|
|
56
60
|
|
|
61
|
+
## Foydalanish (Async)
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import asyncio
|
|
65
|
+
from postgresdb3 import AsyncPostgresDB
|
|
66
|
+
|
|
67
|
+
async def main():
|
|
68
|
+
# Bazaga ulanish
|
|
69
|
+
db = AsyncPostgresDB(
|
|
70
|
+
database="mydb",
|
|
71
|
+
user="postgres",
|
|
72
|
+
password="mypassword",
|
|
73
|
+
host="localhost", # ixtiyoriy
|
|
74
|
+
port=5432 # ixtiyoriy
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Jadval yaratish
|
|
78
|
+
await db.create("users", "id SERIAL PRIMARY KEY, name VARCHAR(100), age INT")
|
|
79
|
+
|
|
80
|
+
# Ma'lumot qo'shish
|
|
81
|
+
await db.insert("users", "name, age", ["Ali", 25])
|
|
82
|
+
await db.insert("users", "name, age", ["Vali", 30])
|
|
83
|
+
|
|
84
|
+
# Barcha ma'lumotlarni olish
|
|
85
|
+
users = await db.select("users")
|
|
86
|
+
print("Barcha foydalanuvchilar:", users)
|
|
87
|
+
|
|
88
|
+
# Bitta qatorni olish
|
|
89
|
+
user = await db.select("users", where=("name=$1", ["Ali"]), fetchone=True)
|
|
90
|
+
print("Foydalanuvchi Ali:", user)
|
|
91
|
+
|
|
92
|
+
# Shart bilan ma'lumot olish
|
|
93
|
+
adults = await db.select("users", where=("age > $1", [18]))
|
|
94
|
+
print("Kattalar:", adults)
|
|
95
|
+
|
|
96
|
+
# Bir nechta shart
|
|
97
|
+
specific_users = await db.select("users", where=("age > $1 AND name = $2", [18, "Ali"]))
|
|
98
|
+
print("Maxsus foydalanuvchi:", specific_users)
|
|
99
|
+
|
|
100
|
+
# Jadvaldagi ma'lumotni yangilash
|
|
101
|
+
await db.update("users", "age", 26, "name", "Ali")
|
|
102
|
+
|
|
103
|
+
# Ma'lumotni o'chirish
|
|
104
|
+
await db.delete("users", "name", "Ali")
|
|
105
|
+
|
|
106
|
+
# Jadvalni o'chirish
|
|
107
|
+
await db.drop("users")
|
|
108
|
+
|
|
109
|
+
# Connection poolni yopish
|
|
110
|
+
await db.close_pool()
|
|
111
|
+
|
|
112
|
+
# Asinxron loop ishga tushirish
|
|
113
|
+
asyncio.run(main())
|
|
114
|
+
```
|
|
115
|
+
|
|
57
116
|
## Parametrlar va metodlar
|
|
58
117
|
|
|
59
118
|
**PostgresDB(database, user, password, host="localhost", port=5432)**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: postgresdb3
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Python uchun oddiy PostgreSQL wrapper
|
|
5
5
|
Home-page: https://github.com/AlijonovUz/PostgresDB
|
|
6
6
|
Author: Abdulbosit Alijonov
|
|
@@ -22,6 +22,10 @@ Dynamic: summary
|
|
|
22
22
|
|
|
23
23
|
# PostgresDB
|
|
24
24
|
|
|
25
|
+

|
|
26
|
+

|
|
27
|
+

|
|
28
|
+
|
|
25
29
|
Oddiy va qulay Python wrapper PostgreSQL bazasi bilan ishlash uchun.
|
|
26
30
|
|
|
27
31
|
## O'rnatish
|
|
@@ -30,7 +34,7 @@ Oddiy va qulay Python wrapper PostgreSQL bazasi bilan ishlash uchun.
|
|
|
30
34
|
pip install postgresdb3
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
## Foydalanish
|
|
37
|
+
## Foydalanish (Sync)
|
|
34
38
|
|
|
35
39
|
``` python
|
|
36
40
|
from postgresdb3 import PostgresDB
|
|
@@ -40,8 +44,8 @@ db = PostgresDB(
|
|
|
40
44
|
database="mydb",
|
|
41
45
|
user="postgres",
|
|
42
46
|
password="mypassword",
|
|
43
|
-
host="localhost",
|
|
44
|
-
port=5432
|
|
47
|
+
host="localhost", # ixtiyoriy
|
|
48
|
+
port=5432 # ixtiyoriy
|
|
45
49
|
)
|
|
46
50
|
|
|
47
51
|
# Jadval yaratish
|
|
@@ -76,6 +80,61 @@ db.delete("users", "name", "Ali")
|
|
|
76
80
|
db.drop("users")
|
|
77
81
|
```
|
|
78
82
|
|
|
83
|
+
## Foydalanish (Async)
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import asyncio
|
|
87
|
+
from postgresdb3 import AsyncPostgresDB
|
|
88
|
+
|
|
89
|
+
async def main():
|
|
90
|
+
# Bazaga ulanish
|
|
91
|
+
db = AsyncPostgresDB(
|
|
92
|
+
database="mydb",
|
|
93
|
+
user="postgres",
|
|
94
|
+
password="mypassword",
|
|
95
|
+
host="localhost", # ixtiyoriy
|
|
96
|
+
port=5432 # ixtiyoriy
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
# Jadval yaratish
|
|
100
|
+
await db.create("users", "id SERIAL PRIMARY KEY, name VARCHAR(100), age INT")
|
|
101
|
+
|
|
102
|
+
# Ma'lumot qo'shish
|
|
103
|
+
await db.insert("users", "name, age", ["Ali", 25])
|
|
104
|
+
await db.insert("users", "name, age", ["Vali", 30])
|
|
105
|
+
|
|
106
|
+
# Barcha ma'lumotlarni olish
|
|
107
|
+
users = await db.select("users")
|
|
108
|
+
print("Barcha foydalanuvchilar:", users)
|
|
109
|
+
|
|
110
|
+
# Bitta qatorni olish
|
|
111
|
+
user = await db.select("users", where=("name=$1", ["Ali"]), fetchone=True)
|
|
112
|
+
print("Foydalanuvchi Ali:", user)
|
|
113
|
+
|
|
114
|
+
# Shart bilan ma'lumot olish
|
|
115
|
+
adults = await db.select("users", where=("age > $1", [18]))
|
|
116
|
+
print("Kattalar:", adults)
|
|
117
|
+
|
|
118
|
+
# Bir nechta shart
|
|
119
|
+
specific_users = await db.select("users", where=("age > $1 AND name = $2", [18, "Ali"]))
|
|
120
|
+
print("Maxsus foydalanuvchi:", specific_users)
|
|
121
|
+
|
|
122
|
+
# Jadvaldagi ma'lumotni yangilash
|
|
123
|
+
await db.update("users", "age", 26, "name", "Ali")
|
|
124
|
+
|
|
125
|
+
# Ma'lumotni o'chirish
|
|
126
|
+
await db.delete("users", "name", "Ali")
|
|
127
|
+
|
|
128
|
+
# Jadvalni o'chirish
|
|
129
|
+
await db.drop("users")
|
|
130
|
+
|
|
131
|
+
# Connection poolni yopish
|
|
132
|
+
await db.close_pool()
|
|
133
|
+
|
|
134
|
+
# Asinxron loop ishga tushirish
|
|
135
|
+
asyncio.run(main())
|
|
136
|
+
```
|
|
137
|
+
|
|
79
138
|
## Parametrlar va metodlar
|
|
80
139
|
|
|
81
140
|
**PostgresDB(database, user, password, host="localhost", port=5432)**
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|