Skip to content

Commit

Permalink
moved copying to appropriate section
Browse files Browse the repository at this point in the history
  • Loading branch information
emehrkay committed Feb 12, 2017
1 parent 684ced0 commit daac100
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions README.md
Expand Up @@ -236,6 +236,25 @@ Nesting allows you to have more control over query creation, it offers some sani
g.bound_params # {'GP_XXQ_1': 12, 'GP_UYI': 33, 'GP_UYI_3': 'age'}
```

###Copying

Gremlinpy has a built-in way to copy instances. This is useful for when you want to branch at a current point along the path, but keep the preceding definitions in tact.

```python
page = get_page()
per_page = get_per_page()

g = Gremlin().hasLabel('user').hasId(15).out('blog_post') # get all of the blog posts for user 15

# we will branch here to get the total number of posts for the user
total = g.copy().size()

# we continue here to paginate
g.range(page, page * per_page)

# run queries
```

##Statements

Gremlinpy allows you to compose very complex gremlin chains. A Gremlinpy Statement object allows you to encapsulate and package a part of that construction.
Expand Down Expand Up @@ -306,25 +325,6 @@ A statement can be passed into a Gremlin instance Function, Raw, Closure call. T
g.bound_params # {'GP_DDIO_1': 44}
```

###Copying

Gremlinpy has a built-in way to copy instances. This is useful for when you want to branch at a current point along the path, but keep the preceding definitions in tact.

```python
page = get_page()
per_page = get_per_page()

g = Gremlin().hasLabel('user').hasId(15).out('blog_post') # get all of the blog posts for user 15

# we will branch here to get the total number of posts for the user
total = g.copy().size()

# we continue here to paginate
g.range(page, page * per_page)

# run queries
```

##Performance Tweaks
###Always Manually Bind Params

Expand Down

0 comments on commit daac100

Please sign in to comment.