the oracle client really doesn't know anything about your database, it just
spits what oracle has to tell.
DAL is an "Abstraction", so to "abstract" a model, it needs the definition
(the brain that designed the oracle table had it, it just translated to SQL
rather than python)
But let's put it in another way:
let your oracle client insert in a table a row and fetch the newly inserted
id. Using DAL, you can just issue this
newly_inserted = db.table.insert(datetime_field=request.now, integer_field=2
)
or, fetch all rows pertaining to the current year, then for each line print
a different column. Using DAL, you can just issue this
results = db(db.table.datetime_field.year() == 2016).select()
for row in results:
print row.integer_field
Go ahead and as an exercise, use your oracle client: the goal is use less
lines (and characters) than the aforementioned snippets (feel free to count
the define_table statement too).
Then count how many times you do CRUD operations in your app. Then multiply
by the difference.
If the result is less than 100 lines, use db.executesql(). And you get no
automatic representation of the result in a nice table, no grid, no
smartgrid, and you locked your app's code to run on Oracle only.
If you need one of the above, or the result is more than 100 lines, join
the "it's better to define a model for a database" world ^_^
On Monday, June 6, 2016 at 11:17:34 PM UTC+2, Sammy wrote:
>
> Oh sure, I understand the importance of define.table as a way to create
> table if it does not exist already. But for existing tables, how is it that
> an oracle client is able to understand the structure of a table to do
> queries without further instructions but for DAL you need to explicitly
> define it?
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.