Skip to content

Commit

Permalink
add missing modules to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wd60622 committed Oct 12, 2023
1 parent 67f89fc commit 209af01
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 18 deletions.
7 changes: 7 additions & 0 deletions docs/api/pypika.analytics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pypika.analytics module
=======================

.. automodule:: pypika.analytics
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/api/pypika.dialects.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pypika.dialects module
======================

.. automodule:: pypika.dialects
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/api/pypika.pseudocolumns.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pypika.pseudocolumns module
===========================

.. automodule:: pypika.pseudocolumns
:members:
:undoc-members:
:show-inheritance:
4 changes: 3 additions & 1 deletion docs/api/pypika.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ pypika package

.. toctree::


pypika.analytics
pypika.dialects
pypika.enums
pypika.functions
pypika.pseudocolumns
pypika.queries
pypika.terms
pypika.utils
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.viewcode',
'numpydoc',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
36 changes: 25 additions & 11 deletions pypika/__init__.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,49 @@
"""
PyPika is divided into a couple of modules, primarily the ``queries`` and ``terms`` modules.
pypika.queries
--------------
pypika.analytics
----------------
This is where the ``Query`` class can be found which is the core class in PyPika. Also, other top level classes such
as ``Table`` can be found here. ``Query`` is a container that holds all of the ``Term`` types together and also
serializes the builder to a string.
Wrappers for SQL analytic functions
pypika.terms
pypika.dialects
---------------
This contains all of the dialect specific implementations of the ``Query`` class.
pypika.enums
------------
This module contains the classes which represent individual parts of queries that extend the ``Term`` base class.
Enumerated values are kept in this package which are used as options for Queries and Terms.
pypika.functions
----------------
Wrappers for common SQL functions are stored in this package.
pypika.enums
------------
pypika.pseudocolumns
--------------------
Enumerated values are kept in this package which are used as options for Queries and Terms.
Wrappers for common SQL pseudocolumns are stored in this package.
pypika.queries
--------------
This is where the ``Query`` class can be found which is the core class in PyPika. Also, other top level classes such
as ``Table`` can be found here. ``Query`` is a container that holds all of the ``Term`` types together and also
serializes the builder to a string.
pypika.terms
------------
This module contains the classes which represent individual parts of queries that extend the ``Term`` base class.
pypika.utils
------------
This contains all of the utility classes such as exceptions and decorators.
"""

# noinspection PyUnresolvedReferences
from pypika.dialects import (
ClickHouseQuery,
Expand Down
21 changes: 15 additions & 6 deletions pypika/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,15 @@ class Query:
pattern.
This class is immutable.
Examples
--------
Simple query
.. code-block:: python
from pypika import Query, Field
q = Query.from_('customers').select('*').where(Field("id") == 1)
"""

@classmethod
Expand All @@ -367,7 +376,7 @@ def from_(cls, table: Union[Selectable, str], **kwargs: Any) -> "QueryBuilder":
An instance of a Table object or a string table name.
:returns QueryBuilder
:return: QueryBuilder
"""
return cls._builder(**kwargs).from_(table)

Expand Down Expand Up @@ -458,7 +467,7 @@ def into(cls, table: Union[Table, str], **kwargs: Any) -> "QueryBuilder":
An instance of a Table object or a string table name.
:returns QueryBuilder
:return QueryBuilder
"""
return cls._builder(**kwargs).into(table)

Expand All @@ -478,7 +487,7 @@ def select(cls, *terms: Union[int, float, str, bool, Term], **kwargs: Any) -> "Q
A list of terms to select. These can be any type of int, float, str, bool, or Term. They cannot be a Field
unless the function ``Query.from_`` is called first.
:returns QueryBuilder
:return: QueryBuilder
"""
return cls._builder(**kwargs).select(*terms)

Expand All @@ -493,7 +502,7 @@ def update(cls, table: Union[str, Table], **kwargs) -> "QueryBuilder":
An instance of a Table object or a string table name.
:returns QueryBuilder
:return: QueryBuilder
"""
return cls._builder(**kwargs).update(table)

Expand All @@ -507,7 +516,7 @@ def Table(cls, table_name: str, **kwargs) -> _TableClass:
A string table name.
:returns Table
:return: Table
"""
kwargs["query_cls"] = cls
return Table(table_name, **kwargs)
Expand All @@ -523,7 +532,7 @@ def Tables(cls, *names: Union[TypedTuple[str, str], str], **kwargs: Any) -> List
A list of string table names, or name and alias tuples.
:returns Table
:return: Table
"""
kwargs["query_cls"] = cls
return make_tables(*names, **kwargs)
Expand Down

0 comments on commit 209af01

Please sign in to comment.