question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] how to insert literal sql fragment to query

See original GitHub issue

how does one express: SELECT * FROM table WHERE timestamp > '-infinity'; or INSERT INTO table (...., col1) VALUES (....) ON CONFLICT (id) DO UPDATE SET col1 = DEFAULT;

w/ peewee?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
coleifercommented, Apr 16, 2019

the fact AsIs isn’t anywhere in the documentation lead to the issue being filed.

And yet your issue makes no mention of AsIs until we get down to the comments.

Did you try Value('-infinity') ?

0reactions
james-lawrencecommented, Apr 16, 2019
Model.select().where(Model.timestamp > peewee.SQL('-infinity')).execute()

fails with peewee.ProgrammingError: column "infinity" does not exist because it doesn’t quote. and if you try to force the quotes it starts escaping them (which is fine btw)

Model.select().where(Model.created_at > peewee.AsIs('-infinity')).execute()

succeeds because it quotes.

the fact AsIs isn’t anywhere in the documentation lead to the issue being filed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Statement Fragments · doobie - tpolecat
Composing SQL literals. You can construct a SQL Fragment using the fr interpolator, which behaves just like the sql interpolator. Fragments are concatenated ......
Read more >
Type literal line feed in SQL string - Stack Overflow
INSERT INTO foo (bar) VALUES ('This is' + ' a line');. Is there a keyboard-shortcut to just ...
Read more >
Syntax | ClickHouse Docs
The INSERT INTO t VALUES fragment is parsed by the full parser, and the data (1, 'Hello, world'), (2, 'abc'), (3, 'def') is...
Read more >
SPARQL 1.1 Query Language - W3C
This section provides an informal introduction to SPARQL FILTER s; their semantics are defined in section 'Expressions and Testing Values' where ...
Read more >
SQL Expression Language Tutorial (1.x API)
Version Check; Connecting; Define and Create Tables; Insert Expressions ... The other approaches it from the perspective of literal schema and SQL ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found