*** eankutse has joined #openstack-dns | 00:02 | |
*** jmcbride has joined #openstack-dns | 00:06 | |
*** zane has quit IRC | 00:11 | |
*** eankutse has quit IRC | 00:37 | |
*** jmcbride has quit IRC | 00:41 | |
*** jmcbride has joined #openstack-dns | 00:47 | |
*** nosnos has joined #openstack-dns | 01:06 | |
*** jmcbride has quit IRC | 03:37 | |
*** betsy has quit IRC | 04:00 | |
*** nosnos has quit IRC | 10:26 | |
*** nosnos has joined #openstack-dns | 10:27 | |
*** nosnos has quit IRC | 10:27 | |
*** nosnos has joined #openstack-dns | 10:28 | |
*** nosnos has quit IRC | 10:35 | |
openstackgerrit | Kiall Mac Innes proposed a change to stackforge/designate: Allow default SOA values to be configured https://review.openstack.org/46469 | 10:36 |
---|---|---|
*** nosnos has joined #openstack-dns | 10:36 | |
*** nosnos has quit IRC | 10:40 | |
*** CaptTofu has quit IRC | 12:34 | |
*** betsy has joined #openstack-dns | 12:47 | |
openstackgerrit | A change was merged to stackforge/designate: Allow default SOA values to be configured https://review.openstack.org/46469 | 12:56 |
*** eankutse has joined #openstack-dns | 13:18 | |
*** eankutse has quit IRC | 13:19 | |
*** eankutse has joined #openstack-dns | 13:19 | |
kiall | eankutse: Heya - Sorry, haven't had a chance to respond to your email yet.. Busy day so far :) | 13:34 |
eankutse | Kiall: np. whenever you get the chance :-) | 13:39 |
kiall | Sure - Short answer, we probably need to do something along the lines of UPDATE records SET content = SUBSTR(content, 'oldname', 'newname') WHERE type = SOA AND content LIKE '%oldname%'; | 13:40 |
kiall | (wrapped in a TX) | 13:40 |
kiall | Long answer: I haven't looked close enough yet :) | 13:40 |
eankutse | so SUBSTR is part of the SQLAlchemy SQL Expression Language? | 13:40 |
kiall | yea .. `from sqlalchemy import func` when update().values(content=func.substring(something here)).execute() | 13:41 |
kiall | s/when/then/ | 13:42 |
eankutse | k. That's cool. Thanks :-) | 13:42 |
kiall | Re the TX.. I'm working on a bug at the mo that needs one in the powerdns driver.. http://pastie.org/private/19shedjf5hfzrqp8ea | 13:42 |
kiall | that should be a half decent example | 13:43 |
eankutse | Yes. I am wrapping in TX for atomicity | 13:43 |
kiall | ehh.. more like this actually.. a commit is useful ;) http://pastie.org/private/1l0amf1oy7mw4rmpoyg6uq | 13:44 |
eankutse | Yes. That's what I am doing. I just did not know about the func.substring(). That should be very helpful. | 13:46 |
*** betsy has quit IRC | 13:56 | |
*** jmcbride has joined #openstack-dns | 14:12 | |
*** jmcbride has quit IRC | 14:13 | |
*** jmcbride has joined #openstack-dns | 14:14 | |
*** msisk has joined #openstack-dns | 14:26 | |
*** betsy has joined #openstack-dns | 14:43 | |
*** artom has quit IRC | 14:52 | |
eankutse | Kiall: I think my main problem is that the 'content' field in the records table is defined in impl_powerdns/models.py as: content = Column(Text, default=None, nullable=True). So, in order to perform a substr operation or any other string operation on the value in the field one has to be able to retrieve the value from that field as a string and to do this within the bulk query that I am using. So, in the query, when I reference records.c.content how w | 15:58 |
kiall | eankutse: message get cut off? | 16:01 |
eankutse | Kiall: oh, my message is incomplete? | 16:03 |
eankutse | I'll try again | 16:03 |
kiall | Yea - got cut off at "when I reference records.c.content how w" | 16:03 |
kiall | (Most IRC clients are smart enough to split long messages when the reach the limit for IRC ;) | 16:03 |
eankutse | … when I reference records.c.content, how would I extract a String object out of it in order to manipulate it with string operatiions? | 16:05 |
kiall | So, It sounds like your trying to do it in python, rather than at the DB? e.g. | 16:05 |
eankutse | no, I am using SQLAlchemy SQL expressions | 16:06 |
kiall | UPDATE records SET content = SUBSTR(content, 'oldns.example.org.', 'newns.example.org.') WHERE content LIKE 'oldns.example.org. %'; | 16:06 |
kiall | and a where clause ;) | 16:06 |
eankutse | This is what I have: | 16:07 |
eankutse | # Update the content field of every SOA record that has the | 16:07 |
eankutse | # old server name as part of its 'content' field to reflect | 16:07 |
eankutse | # the new server name | 16:07 |
eankutse | self.session.execute(models.Record.__table__. | 16:07 |
eankutse | update(). | 16:07 |
eankutse | where(and_(models.Record.__table__.c.type=="SOA", | 16:07 |
eankutse | models.Record.__table__.c.content.like | 16:07 |
eankutse | ("%s%%" % old_server_name)) | 16:07 |
eankutse | ). | 16:07 |
eankutse | values(content=_replace_server_name(XXXXXX, old_server_name, server['name'])) | 16:07 |
eankutse | ) | 16:07 |
kiall | So - We're not needing to load a string .. something like this might work (off to top of my head) | 16:07 |
eankutse | XXXX should be the value from the records.c.content field | 16:07 |
kiall | session.query(models.Record).filter_by(models.Record.content.like("OldNameServer %")).update(content=func.substring(models.Record.content, 'OldNameServer', 'NewNameServer')) | 16:08 |
kiall | whoops - more like | 16:09 |
kiall | session.query(models.Record).filter(models.Record.content.like("OldNameServer %")).filter_by(type='SOA').update(content=func.substring(models.Record.content, 'OldNameServer', 'NewNameServer')) | 16:09 |
kiall | So in your example, "_replace_server_name" shouldn't be a python function you call | 16:10 |
kiall | (well - not one you define youself! You would use SQLA's func.substring() function) | 16:11 |
eankutse | so func.substring() will replace the first occurance of 'OldNameServer' in models.Record.content with 'NewNameServer'? | 16:12 |
kiall | content=func.substring(ColReference, 'find', 'replace') | 16:13 |
kiall | will cause SQLA to emit: | 16:13 |
kiall | SET content = SUBSTR(content, 'find', 'replace') | 16:13 |
eankutse | ok. | 16:13 |
kiall | which will do what we need :) | 16:13 |
eankutse | Yes. I'll try func.substring function. Thx Kiall :-) | 16:14 |
kiall | No problem :) | 16:14 |
* kiall gets back to beating flake8 with a sledge hammer | 16:14 | |
eankutse | :-) | 16:14 |
openstackgerrit | Kiall Mac Innes proposed a change to stackforge/designate: Ensure default TTL is respected by PowerDNS backend https://review.openstack.org/46529 | 16:15 |
kiall | AHHHH! https://github.com/jcrocholl/pep8/commit/15392bdaa73fbf9881a3f0eadd3eef5b9db1adfb | 16:36 |
kiall | pep8 bug preventing me from ignoring these invalid errors -_- | 16:37 |
openstackgerrit | Kiall Mac Innes proposed a change to stackforge/designate: Ensure default TTL is respected by PowerDNS backend https://review.openstack.org/46529 | 16:38 |
*** CaptTofu has joined #openstack-dns | 16:53 | |
*** jmcbride has quit IRC | 17:20 | |
*** CaptTofu has quit IRC | 17:30 | |
*** eankutse has quit IRC | 17:33 | |
openstackgerrit | A change was merged to stackforge/designate: Ensure default TTL is respected by PowerDNS backend https://review.openstack.org/46529 | 17:44 |
*** vipul is now known as vipul-away | 17:49 | |
*** vipul-away is now known as vipul | 17:52 | |
*** eankutse has joined #openstack-dns | 18:05 | |
*** tsimmons has joined #openstack-dns | 18:07 | |
*** jmcbride has joined #openstack-dns | 18:09 | |
*** jmcbride has quit IRC | 18:10 | |
*** jmcbride has joined #openstack-dns | 18:10 | |
*** jmcbride1 has joined #openstack-dns | 18:17 | |
*** jmcbride1 has joined #openstack-dns | 18:17 | |
*** jmcbride has quit IRC | 18:17 | |
*** tsimmons has quit IRC | 18:38 | |
*** tsimmons has joined #openstack-dns | 18:51 | |
*** jmcbride1 has quit IRC | 19:01 | |
*** jmcbride has joined #openstack-dns | 19:05 | |
*** jmcbride1 has joined #openstack-dns | 19:06 | |
*** jmcbride1 has quit IRC | 19:07 | |
*** jmcbride1 has joined #openstack-dns | 19:07 | |
*** jmcbride has quit IRC | 19:10 | |
*** zane has joined #openstack-dns | 19:24 | |
*** tsimmons1 has joined #openstack-dns | 19:31 | |
*** msisk has quit IRC | 19:34 | |
*** tsimmons has quit IRC | 19:35 | |
*** msisk has joined #openstack-dns | 19:37 | |
*** betsy has quit IRC | 19:46 | |
*** tsimmons1 has quit IRC | 19:52 | |
*** tsimmons has joined #openstack-dns | 19:53 | |
*** msisk has quit IRC | 20:13 | |
*** msisk has joined #openstack-dns | 21:03 | |
*** msisk has quit IRC | 21:03 | |
eankutse | Kiall: There is a func.replace() as well so that does the job. Thx. | 21:09 |
*** openstackgerrit has quit IRC | 21:14 | |
*** tsimmons1 has joined #openstack-dns | 21:26 | |
*** tsimmons has quit IRC | 21:30 | |
*** tsimmons1 has quit IRC | 21:31 | |
*** shakayumi has joined #openstack-dns | 22:12 | |
*** shakayumi has quit IRC | 22:18 | |
*** jmcbride has joined #openstack-dns | 22:20 | |
*** jmcbride1 has quit IRC | 22:21 | |
*** eankutse has quit IRC | 22:24 | |
*** jmcbride1 has joined #openstack-dns | 22:44 | |
*** jmcbride has quit IRC | 22:48 | |
*** zane has quit IRC | 23:20 | |
*** eankutse has joined #openstack-dns | 23:28 | |
*** eankutse has quit IRC | 23:52 | |
*** jmcbride1 has quit IRC | 23:57 |
Generated by irclog2html.py 2.14.0 by Marius Gedminas - find it at mg.pov.lt!