New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: added some more operations in Django sample application #637
Conversation
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use -- conventional-commit-lint bot |
Codecov Report
@@ Coverage Diff @@
## postgresql-dialect #637 +/- ##
=====================================================
Coverage 89.23% 89.23%
Complexity 2270 2270
=====================================================
Files 126 126
Lines 7488 7488
Branches 1065 1065
=====================================================
Hits 6682 6682
Misses 559 559
Partials 247 247
Flags with carried forward coverage won't be shown. Click here to find out more. 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
samples/python/django/sample.py
Outdated
def create_tables(): | ||
file = open('create_data_model.sql', 'r') | ||
ddl_statements = file.read() | ||
print(ddl_statements) | ||
# print(ddl_statements) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove commented code
singer.save() | ||
|
||
singer_object = Singer.objects.get(id=singer.id) | ||
if singer_object.first_name != singer.first_name or singer_object.last_name != singer.last_name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and elsewhere: As this is a sample, I think it would be better to just print the singer properties to standard out, and then check for that output in the test case. The sample should as much as possible be aimed at showing how a user can use Django with PGAdapter, and contain as little test code as possible.
raise Exception('Saving Album Data Failed') | ||
|
||
track = create_sample_track('1', '2', album) | ||
track.save(force_insert=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain in a comment why we include force_insert=True
.
|
||
|
||
def interleaved_table_update(): | ||
Track.objects.filter(track_number='2', album_id='1').update(sample_rate=0.25) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain in a comment why we need to do it this way.
samples/python/django/sample.py
Outdated
raise Exception('Update on Interleaved Table Failed') | ||
|
||
|
||
def fetch_data(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename this from fetch_data
to something create_sample_data
.
…CloudPlatform/pgadapter into sample-application-django
No description provided.