sqlalchemy-studio 0.1.6__tar.gz → 0.1.8__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.
Files changed (26) hide show
  1. sqlalchemy_studio-0.1.8/PKG-INFO +97 -0
  2. sqlalchemy_studio-0.1.8/README.md +74 -0
  3. {sqlalchemy_studio-0.1.6 → sqlalchemy_studio-0.1.8}/pyproject.toml +2 -2
  4. {sqlalchemy_studio-0.1.6 → sqlalchemy_studio-0.1.8}/sqlalchemy_studio/Studio.py +1 -0
  5. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/assets/index-0qQM-QLq.js +9 -0
  6. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/assets/index-B8xFyRBc.css +2 -0
  7. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/assets/routes-BJJUUmei.js +1 -0
  8. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/assets/tables._tableName-C7FBzk6i.js +1 -0
  9. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/favicon.ico +0 -0
  10. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/index.html +14 -0
  11. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/logo192.png +0 -0
  12. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/logo512.png +0 -0
  13. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/manifest.json +25 -0
  14. sqlalchemy_studio-0.1.8/sqlalchemy_studio/static/robots.txt +3 -0
  15. sqlalchemy_studio-0.1.8/sqlalchemy_studio.egg-info/PKG-INFO +97 -0
  16. sqlalchemy_studio-0.1.8/sqlalchemy_studio.egg-info/SOURCES.txt +20 -0
  17. sqlalchemy_studio-0.1.6/PKG-INFO +0 -105
  18. sqlalchemy_studio-0.1.6/README.md +0 -82
  19. sqlalchemy_studio-0.1.6/sqlalchemy_studio.egg-info/PKG-INFO +0 -105
  20. sqlalchemy_studio-0.1.6/sqlalchemy_studio.egg-info/SOURCES.txt +0 -10
  21. {sqlalchemy_studio-0.1.6 → sqlalchemy_studio-0.1.8}/setup.cfg +0 -0
  22. {sqlalchemy_studio-0.1.6 → sqlalchemy_studio-0.1.8}/sqlalchemy_studio/__init__.py +0 -0
  23. {sqlalchemy_studio-0.1.6 → sqlalchemy_studio-0.1.8}/sqlalchemy_studio/backend.py +0 -0
  24. {sqlalchemy_studio-0.1.6 → sqlalchemy_studio-0.1.8}/sqlalchemy_studio.egg-info/dependency_links.txt +0 -0
  25. {sqlalchemy_studio-0.1.6 → sqlalchemy_studio-0.1.8}/sqlalchemy_studio.egg-info/requires.txt +0 -0
  26. {sqlalchemy_studio-0.1.6 → sqlalchemy_studio-0.1.8}/sqlalchemy_studio.egg-info/top_level.txt +0 -0
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: sqlalchemy-studio
3
+ Version: 0.1.8
4
+ Summary: FastAPI studio for inspecting SQLAlchemy databases
5
+ Author-email: Xursand Qarlibayev <coderxuz2009@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/coderxuz/sqlalchemy-studio
8
+ Project-URL: Source, https://github.com/coderxuz/sqlalchemy-studio
9
+ Keywords: sqlalchemy,database,inspector,studio
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: build>=1.5.0
19
+ Requires-Dist: fastapi>=0.136.3
20
+ Requires-Dist: sqlalchemy>=2.0.50
21
+ Requires-Dist: twine>=6.2.0
22
+ Requires-Dist: uvicorn>=0.48.0
23
+
24
+ # sqlalchemy-studio
25
+
26
+ FastAPI studio for inspecting and querying SQLAlchemy databases.
27
+
28
+ ## Installation
29
+
30
+ Install from PyPI:
31
+
32
+ ```bash
33
+ pip install sqlalchemy-studio
34
+ ```
35
+
36
+ Or install the latest version from GitHub:
37
+
38
+ ```bash
39
+ pip install --upgrade git+https://github.com/coderxuz/sqlalchemy-studio.git@main#subdirectory=sqlalchemy-studio-backend
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ Create a normal SQLAlchemy engine and declarative base, then pass them to `Studio`.
45
+
46
+ ```python
47
+ from sqlalchemy import Integer, String, create_engine
48
+ from sqlalchemy.orm import DeclarativeBase, Mapped, Session, mapped_column
49
+
50
+ from sqlalchemy_studio import Studio
51
+
52
+
53
+ class Base(DeclarativeBase):
54
+ pass
55
+
56
+
57
+ class User(Base):
58
+ __tablename__ = "users"
59
+
60
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
61
+ username: Mapped[str] = mapped_column(String(50), nullable=False)
62
+ email: Mapped[str] = mapped_column(String(120), nullable=False)
63
+
64
+
65
+ engine = create_engine("sqlite:///app.db")
66
+
67
+
68
+ def seed_data() -> None:
69
+ Base.metadata.create_all(engine)
70
+
71
+ with Session(engine) as session:
72
+ if session.query(User).count() == 0:
73
+ session.add_all(
74
+ [
75
+ User(username="john", email="john@example.com"),
76
+ User(username="alice", email="alice@example.com"),
77
+ ]
78
+ )
79
+ session.commit()
80
+
81
+
82
+ if __name__ == "__main__":
83
+ seed_data()
84
+ Studio(engine=engine, base=Base).run(port=7000)
85
+ ```
86
+
87
+ Run the script:
88
+
89
+ ```bash
90
+ python app.py
91
+ ```
92
+
93
+ Open `http://localhost:7000` in your browser.
94
+
95
+
96
+
97
+ ![Example dashboard](image.png)
@@ -0,0 +1,74 @@
1
+ # sqlalchemy-studio
2
+
3
+ FastAPI studio for inspecting and querying SQLAlchemy databases.
4
+
5
+ ## Installation
6
+
7
+ Install from PyPI:
8
+
9
+ ```bash
10
+ pip install sqlalchemy-studio
11
+ ```
12
+
13
+ Or install the latest version from GitHub:
14
+
15
+ ```bash
16
+ pip install --upgrade git+https://github.com/coderxuz/sqlalchemy-studio.git@main#subdirectory=sqlalchemy-studio-backend
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Create a normal SQLAlchemy engine and declarative base, then pass them to `Studio`.
22
+
23
+ ```python
24
+ from sqlalchemy import Integer, String, create_engine
25
+ from sqlalchemy.orm import DeclarativeBase, Mapped, Session, mapped_column
26
+
27
+ from sqlalchemy_studio import Studio
28
+
29
+
30
+ class Base(DeclarativeBase):
31
+ pass
32
+
33
+
34
+ class User(Base):
35
+ __tablename__ = "users"
36
+
37
+ id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
38
+ username: Mapped[str] = mapped_column(String(50), nullable=False)
39
+ email: Mapped[str] = mapped_column(String(120), nullable=False)
40
+
41
+
42
+ engine = create_engine("sqlite:///app.db")
43
+
44
+
45
+ def seed_data() -> None:
46
+ Base.metadata.create_all(engine)
47
+
48
+ with Session(engine) as session:
49
+ if session.query(User).count() == 0:
50
+ session.add_all(
51
+ [
52
+ User(username="john", email="john@example.com"),
53
+ User(username="alice", email="alice@example.com"),
54
+ ]
55
+ )
56
+ session.commit()
57
+
58
+
59
+ if __name__ == "__main__":
60
+ seed_data()
61
+ Studio(engine=engine, base=Base).run(port=7000)
62
+ ```
63
+
64
+ Run the script:
65
+
66
+ ```bash
67
+ python app.py
68
+ ```
69
+
70
+ Open `http://localhost:7000` in your browser.
71
+
72
+
73
+
74
+ ![Example dashboard](image.png)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sqlalchemy-studio"
7
- version = "0.1.6"
7
+ version = "0.1.8"
8
8
  description = "FastAPI studio for inspecting SQLAlchemy databases"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -34,4 +34,4 @@ urls = { "Homepage" = "https://github.com/coderxuz/sqlalchemy-studio", "Source"
34
34
  include = ["studio*", "sqlalchemy_studio*"]
35
35
 
36
36
  [tool.setuptools.package-data]
37
- studio = ["static/**/*"]
37
+ sqlalchemy_studio = ["static/**/*"]
@@ -74,6 +74,7 @@ class Studio:
74
74
  def _register_routes(self):
75
75
  self.app.include_router(create_tables_router(self))
76
76
  static_dir = files("sqlalchemy_studio").joinpath("static")
77
+
77
78
  if static_dir.is_dir():
78
79
  self.app.mount(
79
80
  "/",