File tree Expand file tree Collapse file tree 5 files changed +83
-7
lines changed Expand file tree Collapse file tree 5 files changed +83
-7
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,15 @@ version: 2
99sphinx :
1010 configuration : docs/source/conf.py
1111 builder : html
12- fail_on_warning : true
12+ # fail_on_warning: true
1313
1414# Optionally build your docs in additional formats such as PDF
15- formats :
16- - pdf
15+ formats : all
1716
1817# Optionally set the version of Python and requirements required to build your docs
1918python :
2019 version : " 3.7"
2120 install :
21+ - method : pip
22+ path : .
2223 - requirements : docs/requirements.txt
Original file line number Diff line number Diff line change 5151# Add any paths that contain custom static files (such as style sheets) here,
5252# relative to this directory. They are copied after the builtin static files,
5353# so a file named "default.css" will overwrite the builtin "default.css".
54- # html_static_path = ['_static']
54+ html_static_path = ['_static' ]
Original file line number Diff line number Diff line change 66 Welcome to sqlalchemyseed's documentation!
77==========================================
88
9+ |pypi | |versions | |license | |build-status | |code-quality | |coverage |
10+
11+ Project links: `Github `_ | `PyPI `_
12+
13+ .. _Github : https://github.com/jedymatt/sqlalchemyseed
14+ .. _PyPI : https://pypi.org/project/sqlalchemyseed
15+
916.. toctree ::
1017 :maxdepth: 2
1118 :caption: Contents
1219
1320 intro
21+ relationships
1422 api
1523
1624Indices and tables
@@ -19,3 +27,28 @@ Indices and tables
1927* :ref: `genindex `
2028* :ref: `modindex `
2129* :ref: `search `
30+
31+
32+ .. |pypi | image :: https://img.shields.io/pypi/v/sqlalchemyseed
33+ :alt: PyPI
34+ :target: https://pypi.org/project/sqlalchemyseed/
35+
36+ .. |versions | image :: https://img.shields.io/pypi/pyversions/sqlalchemyseed
37+ :alt: PyPI - Python Version
38+ :target: https://pypi.org/project/sqlalchemyseed/
39+
40+ .. |license | image :: https://img.shields.io/pypi/l/sqlalchemyseed
41+ :alt: PyPI - License
42+ :target: https://github.com/jedymatt/sqlalchemyseed/blob/main/LICENSE
43+
44+ .. |build-status | image :: https://app.travis-ci.com/jedymatt/sqlalchemyseed.svg?branch=main
45+ :target: https://app.travis-ci.com/jedymatt/sqlalchemyseed
46+
47+ .. |code-quality | image :: https://api.codeclimate.com/v1/badges/2ca97c98929b614658ea/maintainability
48+ :target: https://codeclimate.com/github/jedymatt/sqlalchemyseed/maintainability
49+ :alt: Maintainability
50+
51+
52+ .. |coverage | image :: https://codecov.io/gh/jedymatt/sqlalchemyseed/branch/main/graph/badge.svg?token=W03MFZ2FAG
53+ :target: https://codecov.io/gh/jedymatt/sqlalchemyseed
54+
Original file line number Diff line number Diff line change 11Introduction
22============
33
4- sqlalchemyseed is a SQLAlchemy seeder that supports nested relationships
4+ ` sqlalchemyseed `_ is a SQLAlchemy seeder that supports nested relationships
55with an easy to read text files.
66
77Supported file types.
@@ -10,6 +10,8 @@ Supported file types.
1010- yaml
1111- csv
1212
13+ .. _sqlalchemyseed : https://pypi.org/project/sqlalchemyseed/
14+
1315Installation
1416------------
1517
@@ -36,12 +38,13 @@ Required dependencies
3638Optional dependencies
3739
3840- yaml
41+
3942 - PyYAML>=5.4.0
4043
4144Getting Started
4245---------------
4346
44- Here's a simple snippet to get started from :code: ` main.py ` file.
47+ Here's a simple snippet to get started from `` main.py ` ` file.
4548
4649.. code-block :: python
4750
@@ -62,7 +65,7 @@ Here's a simple snippet to get started from :code:`main.py` file.
6265 session.commit() # or seeder.session.commit()
6366
6467
65- And the :code: ` data.json ` file.
68+ And the `` data.json ` ` file.
6669
6770.. code-block :: json
6871
Original file line number Diff line number Diff line change 1+ Relationships
2+ =============
3+
4+ To add reference attribute,
5+ add prefix to the attribute to differentiate reference attribute from normal ones.
6+
7+ .. code-block :: json
8+
9+ {
10+ "model" : " models.Employee" ,
11+ "data" : {
12+ "name" : " John Smith" ,
13+ "!company" : {
14+ "model" : " models.Company" ,
15+ "data" : {
16+ "name" : " MyCompany"
17+ }
18+ }
19+ }
20+ }
21+
22+ Base on the example above, **name ** is a normal attribute and **!company ** is a reference attribute
23+ which translates to ``Employee.name `` and ``Employee.company ``, respectively.
24+
25+ .. note ::
26+ The default reference prefix is ``! `` and can be customized.
27+
28+ Reference attribute can either be foreign key or relationship attribute.
29+
30+ Customizing prefix
31+ ------------------
32+ If you want '@' as prefix,
33+ you can just specify it to what seeder you use by
34+ adding ref_prefix='@' in the argument when initializing a seeder class.
35+
36+ .. code-block :: python
37+
38+ seeder = Seeder(session, ref_prefix = ' @' )
39+
You can’t perform that action at this time.
0 commit comments