Meta tags:
Headings (most frequently used words):
the, to, your, appveyor, and, travis, you, project, it, of, on, for, that, be, will, this, need, can, an, wheels, setup, next, environment, name, from, build, add, as, projects, in, github, should, configuration, some, sqlalchemy, up, afterthoughts, august, 2014, 2013, binary, variables, account, pypi, twine_password, access, key, id, aws, shared, storage, secret, them, yml, like, settings, encrypt, have, then, encrypted, which, would, added, first, go, hook, is, wheel, running, their, test, support, pip, improvements, with, what, unit, testing, apps, 10, not, or, model, classes, attempting, related, alex, tech, rants, tuesday, october, 17, 2017, how, works, setting, monday, may, 2015, friday, wednesday, january, saturday, november, sunday, 25, blog, archive, about, me, automating, packaging, uploading, define, following, appveyor_slug, appveyor_account, twine_username, user, password, aws_access_key_id, aws_secret_access_key, there, are, two, ways, provide, jobs, file, encrypting, any, confidential, ones, passwords, page, variable, command, line, client, installed, do, something, echo, foobarbaz, output, paste, into, note, importance, switch, without, newline, character, end, cause, wrong, text, assuming, set, section, top, level, menu, click, new, select, pick, list, disable, web, just, necessary, because, only, triggered, by, stage, webhooks, edit, uncheck, active, check, box, press, update, webhook, shown, below, unless, has, special, requirements, hope, lower, barrier, start, producing, noted, prefer, suites, against, separately, each, platform, but, left, exercise, reader, implement, hopefully, day, sort, out, lack, windows, example, could, simplified, somewhat, once, starts, supporting, pyproject, toml, included, sample, enable, removal, install, cython, lines, all, over, concurrent, futures, backport, updated, apscheduler, released, performance, time, zone, integration, asynchronous, event, loops, pluggable, executor, system, scheduler, api, part, universal, method, problem, didn, work, solution, putting, practice, flask, py, common, stumbling, blocks, newbies, finding, right, tutorial, boilerplate, constructors, believing, defining, modifying, creates, modifies, tables, themselves, forgetting, import, modules, before, call, metadata, create_all, confusion, between, one, scalar, understanding, scoped_session, sessionmaker, query, properties, through, relationships, queries, wanting, commit, session, get, object, so, used, insert, objects, tests, using, sqlite, instead, production, rdbms,
Text of the page (most frequently used words):
the (314), and (84), for (70), that (68), you (67), this (64), session (45), your (40), with (38), all (33), sqlalchemy (32), from (31), can (31), are (26), #tables (26), query (25), have (24), testing (22), test (22), but (22), one (21), job (21), #travis (21), not (20), project (20), use (19), which (19), build (19), share (18), there (18), metadata (18), need (18), first (17), should (17), would (17), python (16), when (16), other (16), will (16), been (16), add (16), jobs (16), like (15), then (15), create (15), them (15), database (14), rdbms (14), just (14), was (14), apscheduler (14), appveyor (14), wheels (13), support (13), also (13), connection (13), instance (13), tests (12), has (12), how (11), some (11), now (11), their (11), used (11), name (11), company (11), about (10), unit (10), code (10), only (10), any (10), most (10), using (10), engine (10), users (10), classes (10), category (10), scheduler (10), alex (9), its (9), while (9), transaction (9), back (9), mysql (9), example (9), new (9), model (9), instead (9), thread (9), temporary (9), configuration (9), issues (8), sqlite (8), two (8), following (8), make (8), def (8), import (8), could (8), parent (8), based (8), github (8), projects (8), pypi (8), grönholm (7), out (7), don (7), always (7), data (7), work (7), into (7), features (7), done (7), each (7), these (7), issue (7), single (7), what (7), row (7), get (7), returns (7), commit (7), executor (7), labels (6), pinterest (6), facebook (6), blogthis (6), email (6), comments (6), posted (6), people (6), memory (6), postgresql (6), does (6), many (6), run (6), since (6), without (6), way (6), were (6), class (6), call (6), want (6), application (6), base (6), self (6), found (6), function (6), local (6), because (6), specific (6), running (6), drop (6), however (6), didn (6), set (6), api (6), versions (6), built (6), futures (6), release (6), account (6), settings (6), storage (6), 2013 (5), binary (5), applications (5), solution (5), same (5), more (5), transactions (5), roll (5), before (5), transactional (5), every (5), after (5), suite (5), even (5), setup (5), sure (5), framework (5), orm (5), create_all (5), top (5), start (5), seem (5), something (5), documentation (5), automatically (5), scalar (5), much (5), against (5), employee (5), rows (5), method (5), foreign (5), key (5), process (5), necessary (5), current (5), app (5), request (5), integration (5), next (5), pool (5), concurrent (5), service (5), cpython (5), windows (5), click (5), yml (5), august (4), may (4), yes (4), production (4), different (4), column (4), wrong (4), client (4), than (4), supports (4), nested (4), changes (4), ddl (4), insert (4), update (4), schema (4), they (4), look (4), package (4), remember (4), too (4), web (4), object (4), fixtures (4), global (4), where (4), common (4), order (4), section (4), tutorial (4), who (4), both (4), important (4), default (4), feature (4), such (4), right (4), works (4), see (4), instances (4), easier (4), relationship (4), join (4), task (4), goes (4), flush (4), flask (4), scoped_session (4), sessionmaker (4), number (4), between (4), problem (4), had (4), runs (4), previous (4), several (4), pytest (4), remove (4), scheduling (4), celery (4), started (4), timezone (4), backport (4), environment (4), aws (4), 2014 (3), packaging (3), uploading (3), help (3), often (3), answer (3), why (3), least (3), queries (3), probably (3), asking (3), within (3), savepoint (3), means (3), very (3), thing (3), linked (3), oracle (3), apps (3), practice (3), either (3), aware (3), must (3), close (3), level (3), here (3), declarative (3), around (3), providing (3), someone (3), personally (3), find (3), page (3), starting (3), constructor (3), constructors (3), know (3), change (3), already (3), creates (3), modules (3), anything (3), uses (3), clear (3), confusion (3), still (3), parameters (3), access (3), scoped (3), objects (3), frameworks (3), supposedly (3), course (3), doesn (3), relationships (3), cascade (3), approach (3), related (3), dbsession (3), executes (3), result (3), none (3), tool (3), command (3), updated (3), required (3), provide (3), reflect (3), those (3), step (3), store (3), older (3), path (3), fixture (3), table (3), drop_all (3), monkeypatch (3), end (3), system (3), stores (3), user (3), rest (3), happy (3), fixed (3), switch (3), bug (3), uploaded (3), list (3), variables (3), shared (3), artifacts (3), linux (3), macos (3), complete (2), profile (2), november (2), january (2), 2015 (2), automating (2), october (2), 2017 (2), blog (2), lot (2), channel (2), questions (2), comes (2), almost (2), developers (2), due (2), seems (2), well (2), going (2), deploy (2), good (2), reasons (2), deploying (2), really (2), cause (2), typical (2), server (2), bugs (2), fine (2), reason (2), rather (2), design (2), lets (2), fit (2), small (2), full (2), advantage (2), down (2), delete (2), rolled (2), notably (2), far (2), empty (2), actually (2), accomplish (2), capable (2), root (2), take (2), databasetest (2), requirement (2), teardown (2), create_engine (2), connect (2), rollback (2), __transaction (2), nose (2), optionally (2), certain (2), newbies (2), real (2), mind (2), tutorials (2), official (2), say (2), sense (2), another (2), being (2), metaclass (2), provides (2), explicit (2), unnecessary (2), blame (2), mention (2), existence (2), arguments (2), modifying (2), alter (2), admit (2), mean (2), else (2), expect (2), beginning (2), week (2), return (2), virtually (2), let (2), once (2), select (2), source (2), among (2), try (2), proxy (2), manager (2), virtue (2), sessions (2), looking (2), properties (2), trouble (2), apparently (2), obvious (2), said (2), directly (2), attribute (2), anyone (2), though (2), alias (2), situation (2), called (2), along (2), lines (2), flushed (2), inserted (2), tell (2), difference (2), developer (2), written (2), post (2), teens (2), social (2), filter (2), attempting (2), through (2), address (2), threadlocal (2), generator (2), container (2), raises (2), sole (2), otherwise (2), multipleresultsfound (2), tuple (2), migration (2), usually (2), line (2), foo (2), created (2), left (2), visible (2), finished (2), modified (2), keys (2), working (2), circular (2), dropped (2), constraints (2), hopes (2), finally (2), couple (2), version (2), adapted (2), applying (2), faster (2), decided (2), dropconstraint (2), create_app (2), scope (2), autouse (2), response (2), assert (2), setattr (2), committing (2), prevent (2), closing (2), true (2), existing (2), dedicated (2), allowing (2), requests (2), old (2), earlier (2), part (2), final (2), released (2), management (2), basic (2), capabilities (2), provided (2), backend (2), file (2), thousands (2), persistent (2), keep (2), time (2), utc (2), asynchronous (2), event (2), execution (2), avoids (2), replaced (2), pluggable (2), own (2), supported (2), processpoolexecutor (2), yet (2), allows (2), remote (2), recreate (2), methods (2), painful (2), schedule (2), text (2), reference (2), variable (2), static (2), replace (2), getting (2), requirements (2), add_job (2), improvements (2), noticed (2), upstream (2), nobody (2), gone (2), major (2), enough (2), pools (2), map (2), until (2), available (2), platform (2), requiring (2), install (2), particularly (2), building (2), choose (2), guilty (2), git (2), needs (2), encrypted (2), secret (2), added (2), hook (2), wheel (2), below (2), pip (2), starts (2), lack (2), twine_password (2), encrypt (2), password (2), enter (2), sync (2), services (2), files (2), present (2), amazon (2), upload (2), additional (2), fails (2), three (2), tech (2), rants (2), simple, theme, powered, blogger, view, archive, subscribe, posts, atom, home, freenode, irc, ask, instinctively, simplicity, possibility, leaves, garbage, behind, cleaned, clean, easy, plan, idea, foremost, vastly, enforce, types, erroneously, inputs, type, won, errors, semantic, differences, embedded, occur, pass, second, modest, spaces, big, hindrance, advanced, window, functions, recursive, shortcoming, prevents, taking, chosen, managed, convince, boils, whether, crucial, savepoints, losing, addition, normal, modification, nice, according, article, above, sybase, microsoft, sql, db2, informix, firebird, aforementioned, conveniently, manner, isolated, gets, blank, slate, state, concerned, interrupted, give, adaptable, equally, runners, placed, inherit, override, superclass, implementations, scheme, extension, middleware, whatever, receive, connectable, url, setup_module, begin, teardown_module, dispose, begin_nested, disconnect, yourdb, __init__, repeat, sunday, hanging, years, helping, come, kinds, problems, seeing, patterns, difficulties, persist, amongst, attempt, documenting, answers, solutions, applicable, appearance, frequency, wrote, popped, corrected, facts, occasionally, referring, outside, date, plain, incorrect, place, website, trying, learn, group, able, miss, despite, links, core, sections, think, information, missing, laid, differently, emphasize, suggested, points, making, largely, happily, clearly, pointing, ever, opinion, prominently, advertised, creating, accepts, fields, skip, instantiate, surprising, amount, believe, match, reliably, declared, explicitly, actual, bitten, happen, declare, imported, hadn, thought, scan, structure, admittedly, machinery, puts, magical, everything, itself, kids, filled, useful, pasting, catching, others, complain, value, expression, selected, unheard, assume, exactly, maximum, quite, possibly, greatest, especially, little, experience, threaded, programming, quick, recap, confused, alone, bit, meat, merely, helpers, trivial, scripts, convenience, instantiating, customized, makers, proxies, knows, convenient, multithreaded, worry, accidentally, crossing, threads, certainly, promote, querying, columns, aggregates, expressions, property, asks, thus, falls, syntactic, perspective, might, beyond, knowledge, anyway, fix, nontrivial, imagine, employees, discovered, latter, nicer, separate, previously, company_id, wanting, aliased, anon, companies, factory, words, mapped, things, construct, dynamically, entities, understanding, limit, noresultfound, keyedtuple, noresultexception, forgetting, library, alembic, choice, graphical, phpmyadmin, etc, manually, psql, believing, defining, modifies, themselves, blah, boilerplate, org, finding, stumbling, blocks, saturday, presented, cleanly, leaving, trace, during, target, prominent, vendors, cold, search, reminded, seemed, perfect, structurally, connections, remains, unfortunately, unusable, stick, original, aren, allowed, alternatives, subtle, cyclic, dropping, heard, drops, got, died, quickly, looked, saw, defeat, settle, lowest, denominator, revised, follows, telling, changed, simply, guaranteed, potential, dependencies, preventing, deeper, explanation, reminders, developed, mid, sized, mine, compatibility, recently, migrated, wonderful, generic, multi, tested, mentioned, experimented, ran, seconds, whole, yourapp, setup_db, values, foreign_keys, execute, constraint, expunge_all, addfinalizer, test_example, test_client, status_code, count, 200, lambda, redirect, putting, innodb, myisam, point, uri, lose, development, made, break, isolation, leaking, rolling, reflected, reserved, permitted, porting, nothing, restrict, universal, wednesday, branch, uninitiated, thinking, cron, daemon, inside, off, monitoring, shell, commands, compare, summarized, distributed, queue, featured, queuing, haven, comment, brings, enhancements, albeit, cost, backward, incompatible, fulfilled, smoother, cached, eliminate, overhead, fetching, cases, popping, upon, became, severe, longer, rely, mechanisms, indexes, efficiently, fetch, greatly, reduce, footprints, handle, large, numbers, frequent, complaints, operated, host, preferred, datetimes, defaults, easily, individual, scheduled, timezones, integrates, widely, involves, minimum, loop, delayed, mechanism, custom, similar, subclass, specify, geventscheduler, gevent, spawns, greenlets, pep, 3148, subclasses, replaceable, replacement, rectified, officially, although, executors, except, scratch, pause, resume, completely, reschedule, having, operates, ids, removes, pain, implementing, proxied, returned, retrieve, particular, callables, consisting, fully, qualified, module, lookup, handy, determined, fixes, long, standing, flaw, adding, startup, decorators, removing, supplying, ensure, duplicates, contributed, likely, debut, depend, feedback, rethinkdb, func_name, loops, zone, performance, guide, friday, last, repositories, wasn, marked, watching, repository, viewed, tracker, huge, slew, dating, oops, myself, immediately, mostly, patches, anymore, likewise, brave, possible, reliable, apologies, unreasonable, delays, greedy, behavior, as_completed, duplicate, 20367, accessing, nonexistent, 15015, tasks, 11777, leak, 16284, pythonfutures, monday, plenty, frustration, surrounding, libraries, contain, extensions, frustrated, pre, compatible, compiler, side, complicated, manual, steps, hand, sometimes, droves, nagging, told, tag, push, distribution, folks, adventurous, red, pill, deep, rabbit, hole, adapt, proceeding, output, paste, note, importance, newline, character, assuming, menu, pick, disable, triggered, stage, webhooks, edit, uncheck, active, check, box, press, webhook, shown, unless, special, simplified, somewhat, supporting, included, sample, enable, removal, over, cython, pyproject, toml, hopefully, day, sort, noted, prefer, suites, separately, exercise, reader, implement, hope, lower, barrier, producing, afterthoughts, echo, foobarbaz, installed, encrypting, confidential, ones, passwords, ways, aws_secret_access_key, aws_access_key_id, twine_username, appveyor_account, appveyor_slug, define, recommended, cogwheel, turn, refresh, site, prompted, integrations, enabled, copy, altogether, explained, directory, free, tier, disk, space, satisfy, valid, credit, card, setting, respective, pulls, uploads, gist, successfully, meanwhile, sends, tells, changeset, poll, status, regular, intervals, finishes, failed, succeeds, downloaded, external, via, stages, hinted, recipe, combines, factors, challenge, coordination, tools, ensuring, succeed, naive, configurations, independently, lead, situations, legitimately, blocker, succeeded, botched, hands, makes, challenging, oss, platforms, everyone, combine, powers, continuous, tuesday,
Text of the page (random words):
rt the example configuration could be simplified somewhat once pip starts supporting pyproject toml included in the sample project that should enable the removal of the pip install wheel cython lines all over the configuration posted by alex grönholm at 3 38 am no comments email this blogthis share to x share to facebook share to pinterest labels packaging python monday may 4 2015 concurrent futures backport updated it s been a while since i last updated the backport of the concurrent futures package for python versions older than 3 2 i was looking at my github repositories and noticed that i wasn t marked as watching the pythonfutures repository as i viewed the issue tracker i noticed a huge slew of issues in it some of them dating back to 2013 oops i said to myself i immediately started working on the bugs mostly applying patches from upstream cpython code i also decided to drop support for python 2 5 and 3 1 since nobody seems to be using them anymore likewise the futures top level package which was an alias to concurrent futures is now gone several issues were fixed by the 3 0 1 release cpython issue 16284 bug 32 memory leak in thread and process pools cpython issue 11777 bug 28 map doesn t start tasks until generator is used cpython issue 15015 accessing a nonexistent attribute cpython issue 20367 behavior of concurrent futures as_completed for duplicate arguments backport specific bug 20 map is greedy fixed in 3 0 1 many apologies for the unreasonable delays in getting these fixed there are still some major issues with processpoolexecutor but the upstream code in python 3 3 now uses python 3 specific features and i m not brave enough to try and backport that i m not sure it s even possible so if you need reliable process pools you re going to have to switch to python 3 posted by alex grönholm at 11 22 am no comments email this blogthis share to x share to facebook share to pinterest labels python friday august 1 2014 apscheduler 3 0 released the first final version of apscheduler s 3 0 branch has been released for the uninitiated apscheduler is a task scheduling and management system written in python thinking of it as a cron at daemon running inside your application is not far off but apscheduler also provides management and monitoring of jobs and much more and of course it runs python code instead of shell commands if one were to compare apscheduler with celery the difference could be summarized like this celery is a distributed task queue with basic scheduling capabilities while apscheduler is a full featured scheduler with basic task queuing capabilities users tell me that apscheduler is easier to set up i haven t personally used celery so i can t comment on that the 3 0 update brings many new features and enhancements albeit at the cost of a backward incompatible api virtually all of the feature requests from 2 x have been fulfilled a guide is also provided for 2 x users for smoother migration to 3 0 performance improvements probably the most important change in 3 0 is about the job stores in previous versions all the job stores cached all their jobs in memory this was to eliminate the overhead of fetching them from the backend file or database and that would ve been fine with a small number of jobs but when use cases started popping up that required thousands upon thousands of jobs it became a severe problem so starting with 3 0 persistent job stores no longer keep the jobs in memory but instead rely on backend specific mechanisms such as indexes to efficiently fetch due jobs this will greatly help reduce the memory footprints of applications that need to handle large numbers of jobs time zone support one of the most frequent complaints about apscheduler was that it always operated in the host s local time many users would ve preferred it to always use the utc timezone instead now in 3 0 all datetimes are timezone aware the scheduler has a set timezone which defaults to the local timezone but can easily set to say utc instead individual jobs can also be scheduled with different timezones if necessary integration with asynchronous event loops apscheduler now integrates with several widely used asynchronous application frameworks the integration involves at a minimum the use of the event loop s built in delayed execution mechanism this avoids the use of a dedicated thread for the scheduler with some frameworks the integration can even provide a custom default executor more on those in the next section that runs the jobs in a built in thread pool or similar pluggable executor system the built in thread pool from the previous versions has been replaced with a pluggable executor system each scheduler subclass can specify its own default executor for example geventscheduler uses a gevent specific executor that spawns jobs as greenlets an executor based on the pep 3148 concurrent futures thread pool is used as the default executor on most scheduler subclasses while the thread pool in apscheduler 2 x was supposedly replaceable using a process pool as a replacement didn t work in practice this has been rectified by providing an officially supported processpoolexecutor although no such executors are yet provided this api allows for remote execution much like celery does scheduler api improvements with 3 0 all the parameters of the job except for its id can now be modified in the previous versions you had to remove and recreate the job from scratch to change anything about it you can also pause resume or completely reschedule jobs this avoids having to keep the job parameters around in order to recreate the job the scheduler api now operates on jobs based on their ids this removes a lot of pain when implementing a remote scheduler service based on apscheduler all the job related methods are also proxied on the job instances returned by add_job you can also now retrieve a particular job instance from the scheduler based on its id something that was painful to do with older versions of apscheduler the scheduler now allows you to schedule callables based on a text reference consisting of the fully qualified module name and a variable lookup path for example x y z func_name this is handy for when you need to schedule a function for which a reference can t be automatically determined like static methods finally add_job can now optionally replace an existing job by its id this fixes a long standing design flaw in apscheduler 2 x in which adding a job in a persistent job store at application startup usually using the scheduling decorators would always add a new instance of the job without removing the old one by supplying a static id for the job the user can ensure that there will be no duplicates of the job what s next a couple new features contributed by other people didn t make it into the 3 0 release for one there is a job store class for rethinkdb then there is support for getting the current number of running instances for each job these will likely debut in the 3 1 release the rest will depend on user requirements and feedback happy scheduling posted by alex grönholm at 10 34 pm no comments email this blogthis share to x share to facebook share to pinterest labels apscheduler python wednesday january 1 2014 unit testing sqlalchemy apps part 2 the universal method the problem in an earlier post i presented a method for unit testing sqlalchemy applications cleanly without leaving any trace of the tables created during the run of the test suite however the problem with this method was that it required the target rdbms to support both transactional ddl and nested transactions this requirement left two prominent vendors in the cold mysql and oracle what didn t work in search for a solution i was reminded of the existence of a feature called temporary tables this seemed like a perfect fit for the problem most rdbms s can create both local and global temporary tables local temporary tables are only visible to the connection that created them while global temporary tables are structurally visible to all connections but the data still remains specific to each connection unfortunately oracle only supports global temporary tables which are unusable for unit testing since they stick around after the test suite has finished mysql however does support local temporary tables so i modified the original unit testing code to create all the tables as temporary but that didn t work either because apparently foreign keys between temporary tables aren t allowed since temporary tables didn t provide a working solution i had to look into other alternatives the most obvious one would of course be to reflect the metadata at the beginning and use metadata drop_all this approach however has one subtle issue circular relationships if the tables are linked in a cyclic relationship like a b c a then these tables can t be dropped without first dropping the foreign key constraints but then i heard of the drop table cascade command which supposedly drops the foreign keys too along the way this got my hopes up even though sqlalchemy didn t support this directly those hopes however died quickly when i looked at the mysql documentation and saw this restrict and cascade are permitted to make porting easier in mysql 5 6 they do nothing the solution with this i had to admit defeat and settle for the lowest common denominator as such the revised testing process goes as follows reflect the metadata from the database reserved for unit testing drop all foreign key constraints using the old metadata drop all tables using the reflected metadata create all tables from the current model add any base data fixtures and commit the session prevent your application and framework from committing or closing the session run the tests rolling back the transaction at the end of each test step 1 is necessary because there s no telling how much your model has changed between test runs so simply running drop_all with your current model s metadata is not guaranteed to do the right thing step 2 is necessary because of potential circular foreign key dependencies preventing some tables from being dropped see the previous section for a deeper explanation step 6 is necessary for two reasons allowing commit would break test isolation by leaking database changes to other tests allowing the session to close would mean that any changes made between requests within a single test would be rolled back finally a couple reminders remember to point the connection uri to a dedicated testing database so you don t lose development not to mention production data when testing on mysql use innodb tables since myisam doesn t support transactions putting it to practice with flask and py test i developed this testing method to run unit tests on a new mid sized flask based web app of mine that had to use mysql as its data store for compatibility with an older version i ve also recently migrated from nose to the wonderful py test testing framework the following code is a generic testing example adapted from my application s test suite it works with a single db configuration but could be adapted to a multi db configuration i ve tested it against mysql 5 5 postgresql 9 1 and sqlite 2 6 0 it should be mentioned that i experimented with applying the faster method based on nested transactions but my test suite ran only 0 6 seconds faster with it and the approach required a whole different code path on several fixtures so i decided to drop it from sqlalchemy schema import metadata dropconstraint import pytest from yourapp import db create_app pytest fixture scope session def app request return create_app pytest fixture scope session autouse true def setup_db request app clear out any existing tables metadata metadata db engine metadata reflect for table in metadata tables values for fk in table foreign_keys db engine execute dropconstraint fk constraint metadata drop_all create the tables based on the current model db create_all add base data here db session flush db session expunge_all db session commit pytest fixture autouse true def dbsession request monkeypatch roll back at the end of every test request addfinalizer db session remove prevent the session from closing make it a no op and committing redirect to flush instead monkeypatch setattr db session commit db session flush monkeypatch setattr db session remove lambda none def test_example app with app test_client as client response client get some path assert response status_code 200 assert db session query foo count 5 posted by alex grönholm at 7 19 pm no comments email this blogthis share to x share to facebook share to pinterest labels flask python sqlalchemy testing saturday november 9 2013 10 common stumbling blocks for sqlalchemy newbies i ve been hanging around on sqlalchemy for years now helping other users where i could people come there for help with many different kinds of problems but after a while you start seeing common patterns certain difficulties seem to persist amongst sqlalchemy newbies this is my attempt at documenting these issues and providing answers and solutions where applicable these 10 issues are not in any real order of appearance frequency i just wrote them down in the order in which they popped into my mind updated 2013 09 09 corrected facts in section 5 1 not finding the right tutorial occasionally someone comes on the channel asking questions while referring to a tutorial outside of sqlalchemy org these tutorials are often out of date or just plain incorrect personally when i look for a tutorial on something the first place to look would be the official website of the project you re trying to learn to use i would say that is common sense there s also another group of people who are able to find the official documentation but miss the tutorials despite them being the first links on both the orm and core sections while i don t think there s any important information really missing from the sqlalchemy documentation the top page could probably be laid out differently to emphasize the suggested starting points for new users 2 boilerplate constructors the declarative metaclass provides a default constructor for model classes making explicit constructors largely unnecessary the issue is that many people just don t seem to know about this and happily add explicit constructors to all their classes i actually blame the sqlalchemy documentation for not clearly pointing this out i ve only ever found a single mention of this feature in the documentation in my opinion its existence should be prominently advertised in the orm tutorial so instead of creating a constructor that accepts all your fields as arguments just skip the constructor and instantiate classes like company name foo address blah 3 believing that defining or modifying the model classes creates or modifies the tables themselves a surprising amount of new users seem to believe that sqlalchemy is capable of automatically modifying their tables to match their classes...
|