Skip to content

Conversation

ericharmeling
Copy link
Contributor

@ericharmeling ericharmeling commented Feb 12, 2020

Fixes #6043 .

  • Added page for PonyORM tutorial
  • Added tab for PonyORM in other Python doc pages
  • Added PonyORM to list of Python ORMs

I tested the code in insecure and secure mode. The code works just fine. Pony implemented a retry decorator that they use for all transactions, which lightens the load on us and on users (thanks Pony!).

Note
I won't merge this until we officially launch support.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@awoods187 awoods187 requested review from apantel and rafiss February 12, 2020 19:43
@awoods187
Copy link
Contributor

Let's add this to 19.2 as well!

@ericharmeling
Copy link
Contributor Author

Let's add this to 19.2 as well!

@awoods187
Done!

Copy link
Contributor

@awoods187 awoods187 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ericharmeling
Copy link
Contributor Author

@apantel @rafiss Ping on review :) Just one of you needs to look at this really.

Copy link
Contributor

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

Reviewed 16 of 16 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @apantel)

@ericharmeling ericharmeling requested review from Amruta-Ranade and removed request for apantel February 19, 2020 21:05
@Amruta-Ranade Amruta-Ranade mentioned this pull request Feb 20, 2020
6 tasks
Copy link
Contributor

@Amruta-Ranade Amruta-Ranade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits


The code below uses PonyORM to map Python objects and methods to SQL operations. When you run the code as a script, it performs the following operations:

1. Reads existing account IDs from the bank database.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: bank > bank

$ python3 pony-basic-sample.py
~~~

To verify that the table and rows were created successfully, open a new terminal, and start a new session with the built-in SQL client:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove the comma after "terminal"


<div class="filters filters-big clearfix">
<a href="build-a-python-app-with-cockroachdb.html"><button style="width: 20%" class="filter-button">Use <strong>psycopg2</strong></button></a>
<a href="build-a-python-app-with-cockroachdb-sqlalchemy.html"><button style="width: 20%" class="filter-button">Use <strong>SQLAlchemy</strong></button></a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The Use SQLAlchemy tab looks horizontally off-center in the online preview.


{% include copy-clipboard.html %}
~~~ shell
$ pip install pony
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Same issue as with Django -- might want to remind users to use pip3 if pip doesn't work for them.


## Step 3. Generate a certificate for the `maxroach` user

Create a certificate and key for the `maxroach` user by running the following command. The code samples will run as this user.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a certificate > Create a client certificate

<section class="filter-content" markdown="1" data-scope="secure">

Copy the code below to a file or
<a href="https://raw.githubusercontent.com/cockroachdb/docs/master/_includes/{{page.version.version}}/app/pony-basic-sample.py">download it directly</a>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code looks weird here but renders okay ¯_(ツ)_/¯

100
(1 row)
~~~

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code works perfectly!

@@ -0,0 +1,140 @@
---
title: Build a Python App with CockroachDB and PonyORM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the comments for the 19.2 doc apply to 20.1

Copy link
Contributor Author

@ericharmeling ericharmeling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR @Amruta-Ranade!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @Amruta-Ranade and @rafiss)


v19.2/build-a-python-app-with-cockroachdb-pony.md, line 10 at r1 (raw file):

Previously, Amruta-Ranade (Amruta Ranade) wrote…

nit: The Use SQLAlchemy tab looks horizontally off-center in the online preview.

Fixed.


v19.2/build-a-python-app-with-cockroachdb-pony.md, line 34 at r1 (raw file):

Previously, Amruta-Ranade (Amruta Ranade) wrote…

nit: Same issue as with Django -- might want to remind users to use pip3 if pip doesn't work for them.

Done.


v19.2/build-a-python-app-with-cockroachdb-pony.md, line 45 at r1 (raw file):

Previously, Amruta-Ranade (Amruta Ranade) wrote…

Create a certificate > Create a client certificate

Done.


v19.2/build-a-python-app-with-cockroachdb-pony.md, line 68 at r1 (raw file):

Previously, Amruta-Ranade (Amruta Ranade) wrote…

nit: bank > bank

Done.


v19.2/build-a-python-app-with-cockroachdb-pony.md, line 136 at r1 (raw file):

Previously, Amruta-Ranade (Amruta Ranade) wrote…

The code works perfectly!

Great!


v20.1/build-a-python-app-with-cockroachdb-pony.md, line 2 at r1 (raw file):

Previously, Amruta-Ranade (Amruta Ranade) wrote…

All the comments for the 19.2 doc apply to 20.1

Done.

@ericharmeling ericharmeling merged commit fbd739e into master Feb 24, 2020
@ericharmeling ericharmeling deleted the pony-orm-tutorial branch August 24, 2020 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Docs] PonyORM Tutorial
5 participants