0% found this document useful (0 votes)
2K views

Django Object-Relational Mapper

This document contains questions about Django models, ORM, migrations and other Django concepts. It tests understanding of concepts like creating and connecting models, model fields, model validation, migrations, queries, aggregation functions and more. The key takeaways are that Django ORM allows mapping Python objects to rows in the database, models subclass django.db.models.Model, and migrations are used to modify the database schema.

Uploaded by

Ayush Garg
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Django Object-Relational Mapper

This document contains questions about Django models, ORM, migrations and other Django concepts. It tests understanding of concepts like creating and connecting models, model fields, model validation, migrations, queries, aggregation functions and more. The key takeaways are that Django ORM allows mapping Python objects to rows in the database, models subclass django.db.models.Model, and migrations are used to modify the database schema.

Uploaded by

Ayush Garg
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

Select the incorrect statement.

None

A Django app will contain ALL

Choose the correct option to create a project myworld using the django-admin command.$ $ django-
admin startproject myworld

Choose the correct option to create an app ‘myapp’.python manage.py startapp myapp

Which setting can be used while adding a new Django app?INSTALLED_APPS

Select the incorrect statement: Django ORM.Supports SQLite only

What is the equivalent Django ORM query in a Python code for the following?SELECT * FROM
CUSTOMER WHERE name='fresco play'

customer = Customers.objects.filter(name='fresco play')

Object-relational Mapper (ORM) is a code library to automate the data transfer between
_______.Relational DB and Objects

Identify the ORM most used for Flask Web Framework.SQLAlchemy

When choosing field names for the model, it should not conflict with the model API. The field name
should not be _________.clean, save and delete

To rename the Manager for a given class, what attribute type can be used in models.Manager() on that
model?class

id- is the auto assigned primary key by Django with the datatype.models.AutoField()

A Django model is a Python class that subclasses _________.django.db.models.Model

What are the different ways of connecting multiple models relationship?All

When an object is saved, Django _____________.all the options

What can be used to provide custom model validation and to modify attributes on the model like
changing the value on a field upon a conditional check?Model.clean()

What can be used to validate all model fields, if any field is to be exempted from validation? Provide it in
the exclude parameter.Model.clean_fields(exclude=None)

What exception is an attribute of each model class?DoesNotExist

What can be used to validate all unique constraints on the model instead of individual field values?
Model.validate_unique(exclude=None)

Django is loaded with a database-abstraction API to ______. All

Select the incorrect statement about A QuerySet.Incomparable to a database select operation.

Select the incorrect statement: QuerySet API are classified as _________.All

Table names in databases are created by default with app_classname.T

exclude(**kwargs) - Returns QuerySet containing objects matching given lookup parameters.F

Schema Migrations-run custom SQL using RunSQL or python code blocks using RunPython.F

Datamigrations _________.All

Migrations are stored as _______.migration files

How to make a migration run outside transaction in a DDL based transaction?class


Migration(migrations.Migration):

atomic = False

Select the incorrect statement: Migration Operations ________.

migrations aren't automatically done based on history of model changes.

The integrity of Django ORM operations involving multiple queries can be achieved through savepoints.T

What exception is raised, if the primary key is excluded from a Raw query?

InvalidQuery exception
Select the incorrect statement: Database Transaction ________.is started by enabling autocommit using
set_autocommit()

Select the incorrect statement: A database Router uses the method ________.

db_for_delete(model, **hints).

Which creates a new savepoint and returns the savepoint ID (SID)?

Identify the incorrect option: Method that returns a new queryset.earliest()

savepoint(using=None)

Which is not an aggregation function?range

filter(**kwargs) - Returns QuerySet containing objects that do not match the given lookup parameters.F

Name the incorrect field option.None

Name the incorrect field type.none of the options

Identify the incorrect option: Method that does not return a new queryset.difference()

What do you call a migration that creates the first version of the app’s tables initial migration

What is not a related objects reference method?save

Identify the incorrect field lookup option.none

Name the comparison and conversion database functions.All

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy