This commit is contained in:
Itai Shirav 2020-05-28 23:02:34 +03:00
parent 6702cffe72
commit 56cf86a246
3 changed files with 10 additions and 10 deletions

View File

@ -57,9 +57,9 @@ qs.filter(Person.first_name.isIn(['Robert', 'Rob', 'Robbie']))
The `isIn` and `isNotIn` functions expect either a list/tuple of values, or another queryset (a subquery). For example if we want to select only people with Irish last names: The `isIn` and `isNotIn` functions expect either a list/tuple of values, or another queryset (a subquery). For example if we want to select only people with Irish last names:
```python ```python
# A list of values # Last name is in a list of values
qs = Person.objects_in(database).filter(Person.last_name.isIn(["Murphy", "O'Sullivan"])) qs = Person.objects_in(database).filter(Person.last_name.isIn(["Murphy", "O'Sullivan"]))
# A queryset # Last name is in a subquery
subquery = IrishLastName.objects_in(database).only("name") subquery = IrishLastName.objects_in(database).only("name")
qs = Person.objects_in(database).filter(Person.last_name.isIn(subquery)) qs = Person.objects_in(database).filter(Person.last_name.isIn(subquery))
``` ```
@ -76,7 +76,7 @@ For better aggregation performance you can add them to `PREWHERE` section by add
### Old-style filter conditions ### Old-style filter conditions
Prior to version 2 of the ORM, filtering conditions were limited to a predefined set of operators, and complex expressions were not supported. This old syntax is still supported, so you can use it alongside or even intermixed with new-style functions and expressions. Prior to version 2 of the ORM, filtering conditions were limited to a predefined set of operators, and complex expressions were not supported. This old syntax is still available, so you can use it alongside or even intermixed with new-style functions and expressions.
The old syntax uses keyword arguments to the `filter` and `exclude` methods, that are built as `<fieldname>__<operator>=<value>` (two underscores separate the field name from the operator). In case no operator is given, `eq` is used by default. For example: The old syntax uses keyword arguments to the `filter` and `exclude` methods, that are built as `<fieldname>__<operator>=<value>` (two underscores separate the field name from the operator). In case no operator is given, `eq` is used by default. For example:
```python ```python

View File

@ -68,14 +68,14 @@
* [Tests](contributing.md#tests) * [Tests](contributing.md#tests)
* [Class Reference](class_reference.md#class-reference) * [Class Reference](class_reference.md#class-reference)
* [infi.clickhouse_orm.database](class_reference.md#infi.clickhouse_orm.database) * [infi.clickhouse_orm.database](class_reference.md#inficlickhouse_ormdatabase)
* [Database](class_reference.md#database) * [Database](class_reference.md#database)
* [DatabaseException](class_reference.md#databaseexception) * [DatabaseException](class_reference.md#databaseexception)
* [infi.clickhouse_orm.models](class_reference.md#infi.clickhouse_orm.models) * [infi.clickhouse_orm.models](class_reference.md#inficlickhouse_ormmodels)
* [Model](class_reference.md#model) * [Model](class_reference.md#model)
* [BufferModel](class_reference.md#buffermodel) * [BufferModel](class_reference.md#buffermodel)
* [DistributedModel](class_reference.md#distributedmodel) * [DistributedModel](class_reference.md#distributedmodel)
* [infi.clickhouse_orm.fields](class_reference.md#infi.clickhouse_orm.fields) * [infi.clickhouse_orm.fields](class_reference.md#inficlickhouse_ormfields)
* [ArrayField](class_reference.md#arrayfield) * [ArrayField](class_reference.md#arrayfield)
* [BaseEnumField](class_reference.md#baseenumfield) * [BaseEnumField](class_reference.md#baseenumfield)
* [BaseFloatField](class_reference.md#basefloatfield) * [BaseFloatField](class_reference.md#basefloatfield)
@ -106,7 +106,7 @@
* [UInt64Field](class_reference.md#uint64field) * [UInt64Field](class_reference.md#uint64field)
* [UInt8Field](class_reference.md#uint8field) * [UInt8Field](class_reference.md#uint8field)
* [UUIDField](class_reference.md#uuidfield) * [UUIDField](class_reference.md#uuidfield)
* [infi.clickhouse_orm.engines](class_reference.md#infi.clickhouse_orm.engines) * [infi.clickhouse_orm.engines](class_reference.md#inficlickhouse_ormengines)
* [Engine](class_reference.md#engine) * [Engine](class_reference.md#engine)
* [TinyLog](class_reference.md#tinylog) * [TinyLog](class_reference.md#tinylog)
* [Log](class_reference.md#log) * [Log](class_reference.md#log)
@ -118,10 +118,10 @@
* [CollapsingMergeTree](class_reference.md#collapsingmergetree) * [CollapsingMergeTree](class_reference.md#collapsingmergetree)
* [SummingMergeTree](class_reference.md#summingmergetree) * [SummingMergeTree](class_reference.md#summingmergetree)
* [ReplacingMergeTree](class_reference.md#replacingmergetree) * [ReplacingMergeTree](class_reference.md#replacingmergetree)
* [infi.clickhouse_orm.query](class_reference.md#infi.clickhouse_orm.query) * [infi.clickhouse_orm.query](class_reference.md#inficlickhouse_ormquery)
* [QuerySet](class_reference.md#queryset) * [QuerySet](class_reference.md#queryset)
* [AggregateQuerySet](class_reference.md#aggregatequeryset) * [AggregateQuerySet](class_reference.md#aggregatequeryset)
* [Q](class_reference.md#q) * [Q](class_reference.md#q)
* [infi.clickhouse_orm.funcs](class_reference.md#infi.clickhouse_orm.funcs) * [infi.clickhouse_orm.funcs](class_reference.md#inficlickhouse_ormfuncs)
* [F](class_reference.md#f) * [F](class_reference.md#f)

View File

@ -17,7 +17,7 @@ class HeadersToMarkdownParser(HTMLParser):
def handle_endtag(self, tag): def handle_endtag(self, tag):
if tag.lower() in HEADER_TAGS: if tag.lower() in HEADER_TAGS:
indent = ' ' * int(self.inside[1]) indent = ' ' * int(self.inside[1])
fragment = self.text.lower().replace(' ', '-') fragment = self.text.lower().replace(' ', '-').replace('.', '')
print('%s* [%s](%s#%s)' % (indent, self.text, sys.argv[1], fragment)) print('%s* [%s](%s#%s)' % (indent, self.text, sys.argv[1], fragment))
self.inside = None self.inside = None
self.text = '' self.text = ''